1

I apologise if this sound super n00b of me but whenever I try to Google for this info all I get is "Get my plugin to do this or that" posts or people asking how to restrict or free cross site limitations... but nobody is actually answering the most basic of questions:

When a user signs up on a multisite, what sites do they actually have access to?

I want my users to sign up on my site (one of my subsites is the only place that offers a signup link) and then have access to all my subsites (more specifically, my main site). When they sign up I can see in my Users section that they are not assigned to ANY site at all... yet some of the users who navigate to my main site after signing up on my sub-site, when they encounter my custom plugin that checks whether or not the user is logged in before displaying them certain content, those users say "It worked, I got the content. Thanks". At the same time, other users contact me and say "I can't see anything. Where is the content?"

Everyone is registered and nobody is assigned access to any site and yet the user experience for different users differ. Huh !?

So now I am very confused... Does that mean that for every single user that registers on my site I must either manually go and give them access to each of my sites before they have access to anything or I must write/install a plugin that does that for me...? When they register, don't they have access to at least SOMETHING?

I am the super admin and I noticed that I have access to only one of the two sites (according to the users tab) but as the super admin I still have access to both sites (obviously). Now, how in the world I got access to one site listed under my name but not the other site, I do not know. I suspect it might be because I created the subsite after my account already existed (obviously)... but what about new users? They sign up and the Users page say they are now Subscribers with access to none of my sites... Huh!?

Again, my apologies if his sounds super n00b but this is jut confusing the daylights out of me.

  1. What is the point of a register link that gives you access to nothing after signup?
  2. And if you really have access to nothing then why do some users say my plugin works just fine while others say it doesn't when the first thing my plugin does is return if the user is not logged in?
  3. Finally, without having to rely on a third party plugin, what is the correct "WordPress only" way to let users sign up to sub-sites themselves after they have created an account on my network? Is there a wp_subscribe_without_reregistering() function or something I can call?

My apologies again for sounding like a complete n00b. I've had a multisite for years now but both my sites run independently of one another and one site has not had any reason for users to sign up on at all. Now that I am finally requiring cross site access between the third site I just created and the main site, now suddenly I have this issue with some users saying thanks while others are saying "where's the stuff" so it's only now that I am encountering this issue for the first time and all Google is good for is finding links to third party plugins. I can't seem to find the answer to what should be a rather simple question: What do you have access to after registration?

Thanks in advance for any clarification you can offer me

EDIT: Just to add... I ended up adding this to my custom plugin:

function my_join_blogs($user_id)   {
    $blogs_ids = get_sites();
    foreach( $blog_ids as $b ){
        if ( !is_user_member_of_blog( $user_id, $b->blog_id ) )
            add_user_to_blog( $b->blog_id, $user_id, 'subscriber' );
    }
}  
add_action('wpmu_activate_user','my_join_blogs',10,1);

So I don't need links to 3rd party plugins to get users signed up to my subsites. I am just curious about the questions I posed above. Thanks

1
  • One advice: Ask much shorter questions when possible, so more people are willing to spend the time reading and answering.
    – Nikolay
    Commented Oct 29, 2018 at 6:04

1 Answer 1

1

If they signup and choose "Just a username, please.", they get a global user that can login everywhere but has no role anywhere. So if your hidden content requires only a logged-in user, they will get it. If it requires some role, they will not.

If they signup and choose "Gimme a site!" they get a global user that also has an administrator role for they own site.

When different users tell you different things you have to investigate what is their role, and also what does your hidden content require, a role or only a user. Also some of your plugins or themes may change the default signup behavior.

5
  • Thanks for the info. So them not being registered to any site means they HAVE access to everything, just no role. Interesting. I thought the very idea behind "default roles" was to make sure nobody can ever have no role. I.e. a user needs at least the read capability found in even the most restrictive roles. I'll have to google what capabilities a user has with no role. Interesting... As for my plugin, yeah it definitely only checks for is_user_logged_in() and nothing more. I think those who complained just weren't logged in. Only thing that makes sense to me Commented Oct 29, 2018 at 12:26
  • 1
    @RyunosukeJansen You can view the site without the read capability. Even guests without a user can view the site. The read capability gives access to two pages of the admin panel, as it is described here: codex.wordpress.org/Roles_and_Capabilities#read
    – Nikolay
    Commented Oct 29, 2018 at 13:50
  • 1
    @RyunosukeJansen By the way, if your subsites have different domains mapped, it may not log them in automatically to all sites, so they may need to login again if they login on one site and go to another.
    – Nikolay
    Commented Oct 29, 2018 at 13:59
  • 1
    I was afraid I might get criticised for asking something so totally n00b but instead I have learned quite a lot from this question. Thank you very much! One thing I wanted to do very desperately but thought was impossible was to create accounts and deny them access to the Dashboard. I want to create a custom account configuration section and don't want people to go either here or there. It seems a custom role that excludes read might give me exactly that! How unexpected. You inadvertently answered something I assumed was impossible and thus wasn't even going to ask! Thanks very much! :D Commented Oct 30, 2018 at 2:58
  • 1
    @RyunosukeJansen Sure, no problem. You absolutely can deny access to dashboard, actually there are more than one way to do it, and actually there are already free plugins out there that do it. You can also hide the wp admin bar at the top even on the front end part, and there are plugins for that too. You may also need to change the default redirect after login, since users will be redirected to the dashboard I think after login.
    – Nikolay
    Commented Oct 30, 2018 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.