• Resolved John Donovan

    (@johndonovan)


    I’d like to find a way to control the items that are being displayed in the navigation bar/menu – based on (minimally) whether a user is logged-in or (best case) by the user’s role. This can either by a discreet selection for each item defined in the menu or by defining separate menus for each role.

    I have looked a many permissions control plugins (Role Scoper, Members, Members Only Plugin, etc) – and each of these appear to only control whether the content within the post/page/category is displayed … leaving the menu item visible. Our desire is to have control of the menu item, so-as not to raise questions from those without permissions.

    Any suggestions for a viable solution would be most appreciated.

    -john

Viewing 1 replies (of 1 total)
  • Thread Starter John Donovan

    (@johndonovan)

    Solved – thanks to a genius clue from Thom Meridith.

    It was simply a matter of defining a new menu (“public” and “members”), then modifying the header.php for my theme to include:

    <?php  if ( is_user_logged_in() ) {
                         wp_nav_menu ( array ('menu' => 'members' ) );
                  }
                  else {
                         wp_nav_menu ( array ('menu' => 'public') );
                  }

    Of course, this can be expanded to test other conditions as-well ( current_user_can(), etc) and load the appropriate menu.

    This, combined with the ability to manage content access using one of the permissions control systems (Members, Role Scoper, etc) will provide the functionality we’re looking for.

    -john

Viewing 1 replies (of 1 total)
  • The topic ‘Menu Control by Role’ is closed to new replies.