Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




add_new_user_to_blog [ ]

add_new_user_to_blog ( $user_id, $password, $meta )
Parameters:
  • (int) $user_id
  • (mixed) $password Ignored.
  • (array) $meta
See:
Defined at:
Codex



Add a newly created user to the appropriate blog

To add a user in general, use add_user_to_blog(). This function is specifically hooked into the wpmu_activate_user action.

Source

function add_new_user_to_blog( $user_id, $password, $meta ) {
	if ( !empty( $meta[ 'add_to_blog' ] ) ) {
		$blog_id = $meta[ 'add_to_blog' ];
		$role = $meta[ 'new_role' ];
		remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
		add_user_to_blog( $blog_id, $user_id, $role );
		update_user_meta( $user_id, 'primary_blog', $blog_id );
	}
}

Top Google Search Results

User discussions [ wordpress.org ]

User Note(s)