add_existing_user_to_blog()
add_existing_user_to_blog( array $details = false ) 根据m…
add_existing_user_to_blog( array $details = false )
根据maybe_Add_existing_user_to_blog()中的详细信息将用户添加到博客。
Add a user to a blog based on details from maybe_add_existing_user_to_blog().
目录锚点:#参数#返回#源码
参数(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 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!