Answered

Login Logout Menu Item on Genesis Mobile Responsive Themes

If you happen to be using a Genesis theme from StudioPress and are having a problem with your login and logout menu items then DO NOT install the plugin recommended on this page:



BAW Login/Logout Menu Plugin

http://support.membermouse.com/knowledgebase/articles/319081-add-login-logout-link-to-main-menu



#1 - The plugin doesn't work



#2 - The plugin author no longer supports it



#3 - It hasn't been updated in over 2 years



#4 - It creates a venerability



I'm currently using the Altitude Theme from StudioPress. If you're using more than one menu, perhaps a Primary, Secondary and perhaps even a Footer menu, then choosing the option within the MM General Settings / Other Options then selecting the Show Login/Logout Link - it won't work either. The MM code used to display the login and logout links at the end of your menu, interfere with mobile responsive themes.



(Eric please have a look at this ASAP)



The solution is to use this code below. You'll need to open the functions.php file for the Genesis theme you're using and add this to the bottom of your file. Make sure to flush your browser's cache before testing.



=========================



// Adds login and logout to menu

add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );



function sp_add_loginout_link( $items, $args ) {

// Change 'primary' to 'secondary' to put the login link in your secondary nav bar

if ( $args->theme_location != 'primary' )

return $items;



if ( is_user_logged_in() ) {

$items .= '';

} else {

$items .= '';

}



return $items;

}



===============================



If you happened to change the name of your Core login page to something other than "login", then edit the code above to reflect the name of your login page accordingly.



I hope this helps someone. Eric, please fix the login / logout issue as having a membership site is useless if you can't login and most all sites are moving toward mobile responsive theme often with multiple menus.



Also, please remove that out dated Plugin as a recommendation from this page:



http://support.membermouse.com/knowledgebase/articles/319081-add-login-logout-link-to-main-menu



If a plugin is that out of date, it's a vulnerability as well.



Thanks,



John
I'm using the plugin (on Optimizepress rather than Genesis) and it works absolutely fine. No problems at all. Works fine on mobile too.

What vulnerability do you believe it introduces?
Answer
Thanks for providing this info about modifying the Genesis theme to provide login/logout links.

 


Login or Signup to post a comment