Codex tools: Log in
Contents |
Associates a user to a blog, along with specifying the user's role.
<?php add_user_to_blog( $blog_id, $user_id, $role ) ?>
<?php //ADD USER ID 1 TO BLOG ID 1 AS AN EDITOR $user_id = 1; $blog_id = 1; $role = 'editor'; add_user_to_blog( $blog_id, $user_id, $role ) ?> <?php //ADD USER ID 2 TO BLOG ID 3 AS AN ADMINISTRATOR $user_id = 2; $blog_id = 3; $role = 'administrator'; add_user_to_blog( $blog_id, $user_id, $role ) ?>
Use the 'add_user_to_blog' action to fire an event when users are added to a blog.
add_user_to_blog() is located in wp-includes/ms-functions.php.