Hidding New tab Option

Topics: Administration, General
Feb 21, 2014 at 6:43 AM
Edited Feb 21, 2014 at 6:43 AM
I need to hide "New" tab option as well as Content option from the Admin Menu bar. This is require because some of the users. See the following image.

http://www.pixentral.com/show.php?picture=13y3L8mxrxmbusGeGegyHx8m7RHKE
Feb 21, 2014 at 8:20 AM
Mark content items as no creatable (but they will disappear from Content and you need a new way to create them from somewhere else.....)
Feb 21, 2014 at 2:29 PM
CSADNT wrote:
Mark content items as no creatable (but they will disappear from Content and you need a new way to create them from somewhere else.....)
That hardly sounds like a decent workaround...
Feb 21, 2014 at 2:38 PM
Edited Feb 21, 2014 at 3:07 PM
Ok but you do with what options are available and this one needs no coding.
This Creatable / 'Listable Content' problem seems to be a permanent flaw of Orchard.
And the Admin Menu is less than easy to adapt, in fact quite totally unflexible ?

I am also interested by better non coding solutions...
Feb 21, 2014 at 10:30 PM
Use roles and content permissions to keep your users from creating content or content types. Won't that get you what you need? Do you need to actually remove the visual or do you just need to remove the capability to create new contents to certain users?
Feb 26, 2014 at 7:03 AM
@CSADNT Thanks, i am able to hide the New tab, but "Content" option is still visible. Is there a way to hide it as well?
Feb 26, 2014 at 8:42 PM
Edited Feb 26, 2014 at 8:54 PM
Hi,
You should use roles and content permissions as segfahlt suggested.
But if you want to simply hide too the "content" link you can go to Themes/TheAdmin/Views and edit "Menu.cshtml" adding an "if" line after the foreach:
@tag.StartElement
    @foreach(var firstLevelMenuItem in Model) {
        if ((User.Identity.Name != "admin")  && (firstLevelMenuItem.Text.Text == "Content")) { continue;}
       
It's better if you create your own admin theme but this will work as a quick and dirty solution.
And yes, this is an ugly hack. If your user enters the url in the browser bar the contents page will still be there (OrchardLocal/Admin/Contents/List).

This is why you should use content permissions before.

Regards,
Matías
Feb 27, 2014 at 4:22 AM
Thank mmolleja, it worked. Basically i am not using orchard pattern for development, i am creating modules based on standard MVC approach. So i dont have any Content or Part thingy in it. Reason why i am using Orchard is only because of its support for Multi tenancy.