• Hi
    Anyone could help me to set a function that would assign automatically
    contributor or subscriber role to every new registered user on a multisite installation, Thanks

    • This topic was modified 7 years, 4 months ago by edriscouk.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,
    You can set what will be user role when a new user register in your site.
    You will get this option in the users tab .
    thanks.

    Thread Starter edriscouk

    (@edriscouk)

    Thanks ThemesGrove
    But want it to happen automatically, Looking for a function that will let all the new users to have at least a Subscriber role once they r registered

    Hi. This is easy ?? Here it is:

    add_action( 'wpmu_new_user', 'my_new_user_function' );
    
    function my_new_user_function( $user_id ) {
    	add_user_to_blog( get_current_blog_id(), $user_id, 'subscriber' );
    }

    When a new user is created in a multisite, it adds it as a subscriber to the main site.

    Thread Starter edriscouk

    (@edriscouk)

    Perfect, Thank you Nikolay

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Assign contributor role to new users’ is closed to new replies.