By gumnaam1 on
I installed drupal 4.7 and every thing was working fine.
I tried playing with Primary Links and menus.
After some customization the "create content" menu item which was visible under "Navigation"
for only logged in users, is now visible to anonymous users as well.
I am not sure how to prevent not logged in users from seeing the "create content" menu item.
If i click the reset button for "create content", It is moved under Primary links and is disabled, i.e.
no one can see it, in Primary links.
If I change the parent back to navigation then every one can see it.
Please help.
thanks
gumnaam
Comments
Hide the navigation menu block...
Hide the navigation menu altogether for anonymous users. If you want anonymous users to have some rudimentary navigation without the auto-generated menu items, create a new menu.
When you have your two menus, go to administer >> blocks and configure the navigation menu block. Set it to "Show if the following PHP code returns TRUE." Then put the following code in the box:
Do the same with your second menu, which will be available to anonymous users only, but change the code as follows:
That will do it... two unique menu blocks, depending on if the user is logged in or not.
it worked
that worked splendidly,
thanks
Thank you...
...just the problem I had, just the solution I needed. Just thinking a little bit more in advance...
Would it be the drupal style of way to use this approach to provide role-specific menus?
- E.g. roles site admin, content creator.
- create two menus one with create content, etc., and then another with settings, etc.
- make them visible for a logged in user who has a specific role by adding custom PHP code for the block configuration of the two menus. It would then be necessary that the user instance provides access to its role within the PHP block that you kindly provided. Is that possible?
Thanks a lot
FQ
This should work...
The following should hide your block based on specified role names:
Change the == 0 above to > 0 to show your block to specific roles.
Add as many roles as you wish to the array(), in quotes, separated by commas. (Obviously, you need to replace 'my role 1' and 'my role 2' with your own role names, or delete them altogether.)
Also note that every registered member on your site belongs to role 'authenticated user' so be careful with that one.
short-term workaround
i too had this problem of the create content menu item showing even if the user doesn't have permission to see it. anyone know if this has this been posted as a bug yet? anyway, if you reset the "create content" menu item, it goes under the "content" menu item, which links to /node (ie. the homepage). i just changed the text for this menu item from "content" to "home" and positioned it to replace my previous homepage link.
-r
Try resetting all of your
Try resetting all of your Content menus, including sub-menus like Page or Story.
See:
http://drupal.org/node/47212#comment-88892
I replaced code as mentioned but found other error
Thanks to debug this problem providing required changes in code. I have done it but found following other error,
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
public_html/modules/node/node.module on line 1845
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in public_html/modules/node/node.module on line 1845
I have configured Durpal 5.1 just few days ago. Earlier I have no experiece in any CMS and PHP.
Please help me.
Thanks
Please be more specific...
Welcome to Drupal...
Drupal 5.x now has 'Role specific visibility settings' in the block configuration. You shouldn't need to use code. This code was for 4.7.x.
If you still require code for something, please be more specific in your request... copy & paste your code here, putting it between
and
tags so it's visible on this forum.
I'm guessing you didn't copy the code completely, you're not using the single quote ( ' ) or double quote ( " ) to encapsulate strings, or you left out the closing ( ?> ) php tag.
Primary Links
I want to do something similar to what was mentioned above but with the primary links which are not a block therefore the drupal 5.x functionality won't solve my problem. I will have several levels of membership. Member type one should see primary links-1 which will have only forum. Member type two should see primary links-2 which will have limited options, etc. Any suggestions?
removing Create Content from menu
I have Drupal 5.x. I am a newbie. I have FINALLY removed Create Content from all anonymous user menus. I did it in two parts:
After wrestling with the menu module for way, WAY too long, I finally successfully removed Create Content from the Primary Links, which is my 'regular user' (anonymous) navigation menu, which appears horizontally across the top of my site's pages. I accomplished this feat(?!) by using the Menu module to move this item with all of its submenu items under the parent menu item Administration, which is assigned in Blocks to appear in the left sidebar and holds all Administrator-only menu items. There's a lot of discussion about doing this in the above and maybe one or two other threads I found by doing a search on "Create Content remove menu item" in Drupal Support.
But even then Create Content kept appearing for Anonymous users (logged out) in the left sidebar, though no other Administration menu items would appear with it. It was drubeedoo's comment (above) that provided me the final key to the solution: tick only the Administration user under the visibility setting section in BLOCKS (before I made this change, all three--administrator, authenticated and anonymous--were un-ticked).
I nearly wept with joy when I logged out and saw that Create Content no longer appeared anywhere.
Thank you drubeedoo et al,
staunton