• I have added a login link to my WP menu (Community > Parent Login) and everything works well. But I think most people using the site would be confused when they are redirected to the WP backend on login.

    I see elsewhere on the forums this code to add to my functions file to display the login link

    <?php wp_loginout($_SERVER[‘REQUEST_URI’]); ?>

    …but how do I keep the login link in the menus, but allow them to stay on the current page? I don’t know of a way to drop that php code into the menu…

    http://perceptionshost.com/cvms

    http://wordpress.org/extend/plugins/simplemodal-login/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you managing your menu items through wp-admin > Appearance > Menus? If so, you can add a new “Custom Link”. Enter URL: “/wp-login.php?redirect_to=destination_page” Label: “Log In” and click “Add to Menu”. That will add a Log In link to your menu, and when you finish logging in, you’d be directed to the destination_page (destination_page is a placeholder for whatever URL you want to enter).

    But the new Log In link will not use SimpleModal Login, so you’ll need to do one more thing… In the upper-right corner of the Menus admin page, click “Screen Options” and make sure “CSS Classes” is checked. Then, in your menu list, click the disclosure triangle (down arrow) next to “Log In”. For “CSS Classes”, enter “simplemodal-login”.

    If you want to be able to return the user back to the same page rather than a single destiation, you may need to add a function to your theme’s functions.php. Follow the directions on this page: http://wpfirstaid.com/tag/wp_nav_menu/ except, instead of adding a link to “Home” you’d be adding a link to “Login” and use wp_loginout($_SERVER[‘REQUEST_URI’], false) where the instructions have home_url( ‘/’ ) .

    I used peter’s login redirect to resolve this issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: SimpleModal Login] Login link in WP menu, how to redirect to current page?’ is closed to new replies.