New users who create their own blog in WP Multisite get administrator privilages after registration. However, I don't want them to have so many privilages. I know there is a way to change their role on registration to 'contributor' or 'author' however after a whole day of search I really don't know where to find it. Could you help me with it?
2 Answers
I understand that your question is about to establish a default role for a site, such as 'contributor' or 'author', but also when the site does not exists yet.
I found a code snippet that changes the role when the user creates a blog:
function user_role_to_new_blog($blog_id, $user_id) {
add_user_to_blog($blog_id, $user_id, 'author' );
}
add_action( 'wpmu_new_blog', 'user_role_to_new_blog', 10, 2 );
The original link is here.
If you want a default role for the users of the already created site then you go to Network Admin -> Sites, select 'Edit' in a site, then 'Settings' tab and search for a 'default role' setting, you'll see a text for the role and you can change it according to your preferences. After that, save the changes.
Cheers
-
Are you sure it works? I did create a plugin just for that snippet, multisite activated and each new site give the user the admin role, as default. Mar 25, 2020 at 18:38
You have to go to MySites > Network Admin > Sites
Then select the Site you want to modify.
Then under User -> click the user you want -> Then scroll down to the role and change it to whatever you want.
Hope it helps.
-
It won't do because it's all done manually - user will have full admin capabilities until I or some other admin change their role. Jan 14, 2014 at 13:23