Support » Plugin: Menu Item Visibility Control » Hide menu for specific capabilities

  • Resolved VM06

    (@vm06)


    Hello,
    I am using a member plugin “Advanced Access Manager” and some members have a reading access to some pages and not to others. I would like to hide those restricted pages on the menu items.
    Do you know which code I can use to hide those menu items?
    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi!
    So I had a look into that plugin and I believe this will work:

    
    is_user_logged_in() && in_array( 'administrator', array( AAM::getUser()->ID, AAM::getUser()->roles[0] ) )
    

    That checks if current user is an “administrator”. I would recommend however to contact the plugin’s developers and ask them what would be the best approach.
    Hope this helps.

    Thanks so much for your answer. I will try this as soon as I can. The difficulty is that menu restriction must be done according to access reading and not a WordPress role.
    Anyway, thanks once again and will let you know.

    So, I have just tried this code, but unfortunately it does not work 🙁 . I don’t know how to do as I have already contacted the plugin’s developper and he never answered my question.

    Plugin Author shazdeh

    (@shazdeh)

    I’m afraid I’m not familiar enough with the plugin to be able to answer you properly.
    Does the plugin offer any shortcode that would do what you’re looking for? Not for menu items, but say you want to do the same thing for a piece of content, does the plugin have a shortcode that does that?

    Thanks for your answer. The plugin offers the possibility to hide the items from the menu directly (we just need to choose an option). So it is OK.
    Thanks anyway for your help, which is much appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide menu for specific capabilities’ is closed to new replies.