Support » Networking WordPress » Multisite Network Login Functionality — Help?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Sidebar login isn’t that hard.

    wp_login_form() is built in, so the trick to it is plunking in the redirect 🙂

    <?php 
    
    global $user_login, $post;
    
    $permalink = get_permalink($post->ID);
    
    if (is_user_logged_in()) {
        echo 'Hello, ', $user_login, '. <a href="', wp_logout_url(array( 'redirect' => $permalink)), '" title="Logout">Logout</a>';
    } else {
        wp_login_form(array( 'redirect' => $permalink));
    }
    
     ?>

    You may also want to redirect if they get the password wrong: http://wordpress.stackexchange.com/questions/15633/how-can-i-redirect-user-after-entering-wrong-password

    bdd

    (@bws-online)

    Thanks Mika.

    This is all new to me, so apologies for the questions that might seem silly to you. 🙂

    Would that handle the multisite login situation?

    And since posting this, discussions with the client have changed the parameters — instead of a sidebar, we’ll do a login link in a top navigation bar, and also have login required to comment (so it would be in the comment area on the bottom of posts, for example).

    How do I integrate this logic in those locations?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Login is login is login 🙂

    Where you put it doesn’t matter, and the site it’s on doesn’t matter. WP is smart enough to know that you want to login to THIS site 😀

    bdd

    (@bws-online)

    So login is logging in to ALL the sites on the network (as I described)?

    Can you direct me to a resource to show me how to implement what you’re saying? (I don’t know exactly where to put the code to get it to work. I can figure it out with some direction.)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Yes, logging in once logs you in to all sites on the network*

    There are a couple ways about this.

    1) http://wordpress.org/extend/plugins/sidebar-login/

    2) I wrote this a while back and posted it just now for ya: http://halfelf.org/hacks/sidebar-login-widget/

    (* – Caveat: if you use subdomains and/or mapped domains, logging in will not log you in for all sites, as you are protected from cross-domain cookies for your own good.)

    bdd

    (@bws-online)

    Thanks again Mika.

    Unfortunately, as I noted in my initial post, I am using subdomains.

    Also, as I indicated in that initial post, I’d tried the Sidebar Login plugin already (I’ll have to backtrack to see what did/didn’t work for me with that one).

    I’ll also check out the what you posted in #2 for me — much appreciated 🙂 — but do you know of a way to get things to work for how I need them to work (one login allowing login/commenting on all sites in the network)?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    One login DOES allow commenting on all sites.

    What I’m saying is that when you log in to foo.domain.com, your account exists and can be logged into at bar.domain.com, but you are not automatically logged in to all sites.

    And no, there isn’t a workaround. Your browsers won’t allow it. :/

    bdd

    (@bws-online)

    Okay, got it. I’d say “I’ll check with the client” but if there isn’t a workaround, little reason to check — they’ll just have to accept it. 🙂

    I’ll try things out and hopefully mark this as resolved if it’s resolved once I do so.

    Thanks again Mika.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Multisite Network Login Functionality — Help?’ is closed to new replies.