add_user_to_blog

FUNCTION wp-includes\ms-functions.php (ligne 148) github
Adds a user to a blog, along with specifying the user's role. Use the {@see 'add_user_to_blog'} action to fire an event when users are added to a blog.

Paramètres

Entrée :
$blog_id, $user_id, $role
Sortie :
@param int    $blog_id ID of the blog the user is being added to.
@param int    $user_id ID of the user being added.
@param string $role    User role.
@return true|WP_Error True on success or a WP_Error object if the user doesn't exist

Utilisation

// Utilisation de la fonction add_user_to_blog
$result = add_user_to_blog($blog_id, $user_id, $role);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...