• I copied the following code and placed it in the menu item Visibility field that I only want viewable to users who have “administrator” role.

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

    I refreshed the screen using F5 but the menu item still is not viewable to me.

    What am I doing wrong?

    Thanks in advance

    Brenden

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Do you see the admin bar while you’re logged in? You can check the user account and verify you are indeed logged as admin.

    Also, it could be a typo in the visibility rule. Note that the correct code should be:

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

    (Notice the quotation marks). www.remarpro.com used to allow showing code in the plugin description page but that was later removed so now the example codes in the plugin description page show up with wrong quotation marks. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Showing Menu item for a specific user role’ is closed to new replies.