Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Give new network users a default role on the main site
function tees_add_network_default_roles( $user_id ) {
if ( is_main_site() && !is_user_member_of_blog( $user_id ) )
add_user_to_blog( get_current_blog_id(), $user_id, 'subscriber' );
add_action( 'wpmu_activate_user', 'tees_add_network_default_roles', 10, 1 );
add_action( 'wpmu_new_user', 'tees_add_network_default_roles', 10, 1 );
add_action( 'user_register', 'tees_add_network_default_roles', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.