• Hello
    After some digging and tweaking I was able to do a single sign on with independent WordPress installs sharing user data.

    At this point, I’m looking for some information about how to centralize the login/registration for the sites.

    For example : The structure of the site would be this:
    Main Site
    Login/Registration Site
    Sub-site A Sub Site B Sub Site C

    Basically anytime a user clicks on a link on any of the sites – they will be redirected to the Login/Registration Site. They will then register or login and once they do this, they will be redirected to the site they came from. So if a user was on Sub-Site A and clicked on Login – He/She would be taken to the subdomain for login/registration to login. Once he/she clicks on login and is authenticated – he/she would then be redirected to Sub-site A.

    Is this possible? I basically want to centralize all login/registrations through one sub domain vs have login/registration independent on each site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter erich199

    (@erich199)

    I found this code that I can use in my site function.php to redirect my users to a central login domain:

    add_action('init','custom_login');
    
    function custom_login(){
     global $pagenow;
     if( 'wp-login.php' == $pagenow && $_GET['action']!="logout") {
      wp_redirect('http://YOURSITE.com/URL');
      exit();
     }
    }

    However, I need to redirect those users from the central login domain BACK to the site they came from. Also, when they log out – they should be redirected to the site they logged out from NOT the central login/registration domain. I’m having a hard time tracking down some code that will do this.

    • This reply was modified 6 years, 8 months ago by erich199.

    What if you used a modal dialog for the login (in iframe), so you don’t actually leave the page?
    This is how WordPress does its own login when the timer expires.

    Or study the code used on wordpress.org, since it is several sites using one login.
    https://meta.trac.wordpress.org/browser#sites

    Thread Starter erich199

    (@erich199)

    Hi @joyously ,

    Thanks again for your reply. I had considered a modal login method but my purpose for having one central login/registration page was so I didn’t have to install an anti spam plugin on all sites.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Single Login/Registration Location’ is closed to new replies.