• Resolved David Gard

    (@duck_boy)


    Hey all,

    I’ve set up a multisite internally for my company and I am allowing people to register – when they register though, is there a way of automatically granting them access to certain sites in the network?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter David Gard

    (@duck_boy)

    Thanks, that looks perfect for what I need.

    I also found a manual way of doing it, if that better suits someone in the future –

    /**
     * Automatically adds any newly registered users to pre-selected sites in the network
     *
     * @param required integer $user_id The id of the newly registered user
     */
    add_action('wpmu_new_user', 'add_new_users_to_sites', 10, 2);
    function add_new_users_to_sites($user_id){
    	/** add_user_to_blog($site_id, $user_id, $user_role); */
    	add_user_to_blog('1', $user_id, 'author');
    	add_user_to_blog('4', $user_id, 'subscriber');
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatically add user to blog after registration’ is closed to new replies.