Conditional multi-site user redirect from single login page

Hi. I have a WPMU site that has several custom layers to it. Each time a new user registers, a new sub-site is dynamically created for them. The new site is created at a custom location - an address that the user defines in the signup form. all of this works perfectly.

what i am struggling with is the login process. right now, each user has to go to their custom URL/wp-admin to login. what I want is to place a login form on the parent site and then redirect all registered users to their specific website dashboards after a successful login.

i can't find any tutorials that accomplish this. not a programmer by education, but comfortable updating functions.php and a little php as needed.

any suggestions?

thanks in advance!

  • Michelle Shull

    Hi there, Mindspark!

    Interesting idea here! Before we dig in, are you using a tool like Multisite User Management to control the user roles on each site for your registered members? If your users can be members of more than one of your subsites at a time, like if they're members of the primary site and the site they created, this may be a much more complex job. You mention you're using custom URLs, is this with a tool like domain mapping, which lets users map a different URL to the default multisite URL structure (yoursite.com/newsite for sub-directory installs, newsite.yoursite.com for sub-domains. )
    Can you share a few more clues about how you're using custom URLs?

    If it works as I think it does, this may be the tool you need: https://wordpress.org/plugins/wp-multisite-sso/

    You may also need this tool, to redirect your user to their own site, providing they only have a role on that single site, not a role on multiple sites: https://wordpress.org/plugins/peters-login-redirect/

    Hope this helps!

  • mindspark

    Hi Michelle,

    thanks for the quick reply.

    I am not using any plugin to manage members. the website is meant for divorced parents with kids. they sign up on the site and dynamically create a common dashboard comprised of 3 tools - calendar, messaging, and expense sharing.

    I am using gravity forms user registration add on to register new users, and that allows for dynamic creation of sub-sites. every time the new sub-site is created, it is a mirror image of the primary site - a portal site template (second sub-site) using your 'Default Theme' by Aaron Edwards - the registration form also requires the user to provide a custom URL for the new site, something like '2015heird' and that becomes their private URL = domain.com/portal/2015heird/dashboard/

    the registration tool also sends an invite email to the other parent with the specific registration link to the newly created site. Technically, they could find a way to bypass this system, but this is what we have so far. We will address limiting registration for the second parent to only be allowed at their specific URL - but haven't figured that out yet.

    everything is handled on the front end, so no admin area access for any users.

    so, both users have to remember their unique URLs to login, and the client is concerned about that. So, we need to install a login form on the parent site that somehow recognizes the user email and then correctly sends them to their unique front-end dashboard.

    Right now, I have set it up like this:
    login menu link on parent redirects to login form on primary sub-site;
    i am using Ultimate Member to handle front end login forms;

    Also, here is more info -
    parent site is http://oxleyparent.com;
    registration site (this is what gets cloned on new registration) is http://oxleyparent.com/portal;
    user sites are created as subs to the portal site like this:
    'oxleyparent.com/portal/2015Heird/dashboard/'

    does that help?

  • Michelle Shull

    Hey there, mindspark!

    Okay, this is just a slight variation on the standard sub-directory multisite, you're just using a sub-sub-directory here. With this in mind, I think SSO (single sign-on) and Peter's login redirect will help you here, at least when users sign on. You can use a single sign on page, then redirect to the user's site.

    Emailing to correct URLs to your members is going to be a bit trickier, and I'd recommend working with an independent developer here. We can do some customization on the forums, but our time and resources are somewhat limited, which means we need to focus more on support than extension.

    We do have a Jobs Board, the devs who advertise there are independent, while they're members here, they don't work for WPMU DEV.

    Good luck with your project!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.