add_existing_user_to_blog() - WordPress 函数参考中文文档

返回介绍

add_existing_user_to_blog()

发布于 2017-07-23 字数1569 浏览 1083 评论 0

add_existing_user_to_blog( array $details = false )

通过 maybe_add_existing_user_to_blog() 函数获取到的信息,添加用户到博客中。


参数

$details
(array)
(Optional)Default value: false

返回值

(true|WP_Error|void)


源代码

File: wp-includes/ms-functions.php

function add_existing_user_to_blog( $details = false ) {
	if ( is_array( $details ) ) {
		$blog_id = get_current_blog_id();
		$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;
	}
}

更新日志

Version 描述
MU Introduced.

相关函数

Uses

  • wp-includes/load.php:get_current_blog_id()
  • wp-includes/plugin.php:do_action()
  • wp-includes/ms-functions.php:added_existing_user
  • wp-includes/ms-functions.php:add_user_to_blog()

Used By

  • wp-includes/ms-functions.php:maybe_add_existing_user_to_blog()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!