sruefer 0 Report post Posted February 17, 2012 Hi, I am trying to show different navigation for users depending on their roles and capabilities. On a different theme (Swatch, from Woo Themes) I could implement that by modifying the header.php file, essentially replacing the original navigation and writing PHP conditionals, e.g. if (current_user_is("Subscriber")){ wp_nav_menu('menu' => 'User Menu'); // Specific User Menu created with custom menus } elseif (current_user_is("Administrator")) { wp_nav_menu('menu' => 'Admin Menu'); // Other specific Menu created with custom menues } but I cannot get this to work with PageLines. I am using the Base theme and I copied the nav section over from the parent theme. Then I modified the section.php file to add a menu name depending on user role, but it does not work. I think the problem is that I do not want to assign a theme location (because then I have to select specific custom menu). Any idea what I can do to make that work? Thanks a lot, Steffen Share this post Link to post Share on other sites
catrina 103 Report post Posted February 17, 2012 Can you please paste the code you used for the section.php file? Please read the docs before posting. Please do not private message me unless I ask you to. Designer | Catrina Dulay Founder | Catrina and Mouse Share this post Link to post Share on other sites
sruefer 0 Report post Posted February 17, 2012 Hi Catrina, I think I found the solution; I modified the function "section_template()" in the section.php file of the nav section. Below is the modified function code: [code] function section_template() { $container_class = ( ploption('hidesearch') ) ? 'nosearch' : ''; printf('', $container_class ); // --- My own Modification to display alternate menus depending on user role --- // $menu = ''; if (current_user_is("s2member_level1")) { $menu = 'Main Basic'; } elseif (current_user_is("s2member_level2")) { $menu = 'Main Pro'; } else { $menu = 'Main'; } if (current_user_can('administrator')) { $menu = 'Main Admin'; } if(function_exists('wp_nav_menu')) wp_nav_menu( array('menu' => $menu, 'menu_class' => 'main-nav'.pagelines_nav_classes(), 'container' => null, 'container_class' => '', 'depth' => 3, 'fallback_cb'=>'pagelines_nav_fallback') ); else pagelines_nav_fallback(); // --- End of Mod --- // echo ''; if(!ploption('hidesearch')) get_search_form(); echo ''; } [/code] Basically what I did is: - Created $menu parameter, assigning the custom menu name depending on user role (I am using the s2member plugin, which creates additional roles). - Removed 'theme_location' from wp_nav_menu - Added 'menu' to wp_nav_menu That seems to work for now :) Share this post Link to post Share on other sites
catrina 103 Report post Posted February 17, 2012 Cool, thanks for letting us know. Please read the docs before posting. Please do not private message me unless I ask you to. Designer | Catrina Dulay Founder | Catrina and Mouse Share this post Link to post Share on other sites