add_existing_user_to_blog()函数是Wordpress函数,根据maybe_Add_existing_user_to_blog()中的详细信息将用户添加到博客。
add_existing_user_to_blog( array $details = false )
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$details | (array) | 可选 | 用户详细信息。 |
返回(Return)
(true|WP|Error|void)成功时为true,如果用户不存在或无法添加WP|Error对象,则为true。如果未提供$details数组,则为Void。
源码(Source)
/**
* Add a user to a blog based on details from maybe_add_existing_user_to_blog().
*
* @since MU
*
* @global int $blog_id
*
* @param array $details
* @return true|WP_Error|void
*/
function add_existing_user_to_blog( $details = false ) {
global $blog_id;
if ( is_array( $details ) ) {
$result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] );
/**
* Fires immediately after an existing user is added to a site.
*
* @since MU
*
* @param int $user_id User ID.
* @param mixed $result True on success or a WP_Error object if the user doesn't exist.
*/
do_action( 'added_existing_user', $details['user_id'], $result );
return $result;
}
}
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
MU (3.0.0) | wp-includes/ms-functions.php:2162 | 1 function | 4 |