首页>文档>Wordpress开发文档>Wordpress 函数>add_existing_user_to_blog()

add_existing_user_to_blog()

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:21621 function4
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索