In WP multisite, adding or registering a user makes them a network user. This gives the user’s subscriber access to all other sites – without explicitly being given the permission in wp-admin.
If you registered a user in site A. Then that user will have subscriber access to site B. You can explicitly assign the user in site B in the admin http://siteB.com/wp-admin/user-new.php (Add Existing User section)
In WP multisite, adding or registering a user makes them a network user. This gives the user’s subscriber access to all other sites – without explicitly being given the permission in wp-admin.
Is that definitely true? I’ve seen same stated in codex but I don’t see that behaviour. I have a members only (page template) area on one subsite viz
<?php
if ( is_user_logged_in() && current_user_can('subscriber') ) : ?>
<?php the_content(); ?>
<?php endif; ?>
<?php
if ( !is_user_logged_in() || !current_user_can('subscriber') ) : ?>
<p>Please log in to see members' only content:</p>
<?php wp_login_form($args); ?>
<?php endif; ?>
but if i try to login to protected subsite as a user registered on another subsite i don’t get access. I have to explicitly add the user to the protected subsite in admin to get access.
This all users as subscribers anywhere on network functionality would be useful for me but i don’t see it. Maybe it changed in recent wpms versions?
thanks
redsalmon –
Let me clarify. The network user does not get the subscriber role to all sites, just the subscriber access which is really just ‘read’ access. Your code would look like this:
<?php
if ( is_user_logged_in() && current_user_can('read') ) : ?>
<?php the_content(); ?>
<?php endif; ?>
<?php
if ( !is_user_logged_in() || !current_user_can('read') ) : ?>
<p>Please log in to see members' only content:</p>
<?php wp_login_form($args); ?>
<?php endif; ?>
With my wpms set up a subscriber on one blog can access ‘user only’ content on another blog with is_user_logged_in() but not with current_user_can(‘read’) i.e. they are recognised as being logged in but not as having read capability.
current_user_can(‘capability’) not working for me.