• Resolved catalano

    (@catalano)


    Hello,

    If I restrict the view of a page to a registered user is there any way to hide the associated menu item from a non logged in visitor? It doesn’t make sense to have a menu item that’s linked to a page that will just show a blank page if the visitor isn’t logged in.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @catalano ,

    I’m afraid Restrict Content doesn’t have a feature like this built in. It can be done with a helper plugin like Menu Item Visibility Control and a little custom code snippet. The plugin has an example of how to restrict a menu item to administrators only:

    in_array('administrator', $GLOBALS['current_user']->roles)

    You could then replace administrator with any other role name.

    • This reply was modified 4 years, 11 months ago by Ashley. Reason: Remove/replace curly quotes in code sample
    Thread Starter catalano

    (@catalano)

    Hi Ashley,

    Thanks for the follow up. You might want to take a look at User Access Manager (UAM). It’s a similar plugin that restricts content, but it hid the associated menu item as well. It’s not being developed anymore, so maybe there’s some code there you can incorporate into RC.

    Regards,
    Chris

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide menu item?’ is closed to new replies.