WordPress.org

Ready to get started?Download WordPress

Forums

Multisite Network Login Functionality -- Help? (9 posts)

  1. bws-online
    Member
    Posted 1 year ago #

    I have a multisite network where the sites are all connected in concept as well as content (it's a network for a publication that offers different editions for different regions, so each subdomain on the network will be associated with a particular edition).

    The difficulty I'm facing at the moment is in finding a login solution that meets the needs outlined below. (I've tried a few different login plugins that have widgets for the sidebar, but I don't think I've hit on the right one yet (or I'm just missing how to handle the above requirements) -- and some kept giving errors.)

    Here's what I'd like to have happen:

    1. I want a sidebar login. There should be login fields (username/email and password) with a login button. There should be a link to register, and a link if you've forgotten your password. (I don't want Entries RSS, Comments RSS, or WordPress.org links.)

    2. The activity for login will all take place in the sidebar -- you login, then the login form goes away and it says "Welcome (name)!" with an option to logout. I don't want the option for the profile available for anyone. I don't want the dashboard/site admin option available to users with the subscriber role (which is to be the default role when people register on the site).

    3. If you need to register or you've forgotten your password, it's okay to be taken to a new screen, but I want you to be returned to the same page on the subdomain site where you accessed the (register or forgotten password) link once you complete that activity (not to the main network site or a different page on the subdomain site).

    4. When you logout, you should be taken to the page you were on -- I do NOT want the login form then shown in the main content column of the page, too. (That's what happened with one of the plugins I tried -- I logged out, and then the login form was shown both in the sidebar as well as in the main content column.)

    5. I want users to have to register/login in order to leave comments. Because of this, I want users to be able to register for subscriber accounts -- but I do NOT want them to be able to set up new subdomain sites on the network.

    6. I want users to be able to register on one site, and then be able to login to comment on all sites in the network (just with one login to any of the sites on the network).

    Eventually there may be a paid section of the site (for members only) -- if there's a solution that would handle everything above as well as the future paid section, that would be good to know now.

    Plugins I've tried (but haven't been able to get all of the above elements to work right):
    - Custom Meta Widget
    - Login Logout
    - Peter's Login Redirect
    - Sidebar Login
    - Theme My Login

    (I haven't tried/I'm not currently using a member plugin.)

    Thanks for any guidance/suggestions!!!

  2. 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

  3. bws-online
    Member
    Posted 1 year ago #

    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?

  4. 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 :D

  5. bws-online
    Member
    Posted 1 year ago #

    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.)

  6. 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.)

  7. bws-online
    Member
    Posted 1 year ago #

    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)?

  8. 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. :/

  9. bws-online
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic