Login alternatives for website without sidebar

Hello everyone, I have a website that’s not using any sidebars so having a some problems figuring out an alternative way for users to login their accounts.

What I did was create a link on the top menu that says login that takes you to a login page where I’m using the shortcode [s2Member-Login /].

The problem is that the login link is still up there on the top menu when users are logged in, and when clicking on the link it takes you back to the login page rather than the welcome page.

So my questions are, is there a easy way to make the login link say logout when logged in instead?

If not, is there any way I can insert custom links within the schortcode so users who are logged in can see them on the login page? ,

If I can’t do any of the above, how do I insert the in a s2member pro login widget in a page? I understand I need to insert the following code <?php echo s2member_pro_login_widget(); ?> but where do I insert the code if I only want it within one login page?

Do you guys have any advice how I should move forward with my little dilemma? Nothing to advanced please:)

Cheers and thanks everyone,

Brooke

Brooke,

The good news is that there’s an easy and effective solution to this problem. Just install the Login Logout Menu plugin.

It enables you to add a login link to your menu and, if you choose the appropriate option, that will automatically become a logout link for anyone logged in. I’ve been using it for years.

Hi Tim, thanks for the suggestion but it seems like the plugin is using the wp-login.php for users to login and I would like to avoid that and have users login at mysite.com/login/ with the s2member pro login shortcode instead.

Do you have any other tips for solving this problem?

Thank you for your help!

Brooke

Brooke,

Keep the plugin I suggested, but add this to your (child) theme’s functions.php file:

/***** REDIRECT LOGIN *****/ 
function possibly_redirect() { 
    global $pagenow; 
    if ( 'wp-login.php' == $pagenow ) { 
        if ( isset( $_POST['wp-submit'] ) ||   // in case of LOGIN 
            ( isset($_GET['action']) && $_GET['action']=='logout') ||   // in case of LOGOUT 
            ( isset($_GET['checkemail']) && $_GET['checkemail']=='confirm') ||   // in case of LOST PASSWORD 
            ( isset($_GET['checkemail']) && $_GET['checkemail']=='registered') ) return;    // in case of REGISTER 
        else wp_redirect( home_url('/login/') ); 
        exit(); 
    } 
} 
add_action('init','possibly_redirect');

@brookelustig:

I haven’t used the plugin @KTS915 recommends, but I use Nav Menu Roles to set visibility for menu items. You can set visibility by Logged In, Logged Out, and by User Roles (so you could have menu items visible only to Admins, for example.

@JediShark and @brookelustig,

You can happily use the Login Logout Menu plugin together with the Nav Menu Roles plugin.

I am using the Login Logout Menu plugin but when I have it activated my redirection doesn’t work. When a Level 1 subscriber logs in…it takes them to the Home page instead of my Member Welcome Page. When I disable the Login Logout Menu plugin…the redirection works fine.

So…I’m looking for a solution that will allow me to have “Login” and “Logout” links in my menu (depending on if the user is logged in or not) AND redirect them properly to my Member Welcome Page.

@tracyselena, what are you using for the settings in the Login Logout menu plugin? I use that plugin on many sites and it redirects to the Login Welcome Page on login, as intended.

I and use the Log In|Log Out option and have it set to #bawloginout# for the URL.