WordPress函数文档add_existing_user_to_blog()
添加用户到当前博客(多站点) 描述 Add a user to the current blog based …
添加用户到当前博客(多站点)
描述
Add a user to the current blog based on details from maybe_add_existing_user_to_blog().
Note: This function is called by maybe_add_existing_user_to_blog() and should not be called directly. This page is for informational purposes only. Use add_user_to_blog().
用法
<?php add_existing_user_to_blog( $details ) ?>
参数
$details
(array) (可选) Must at least contain values for the keys listed below
默认值: false (which will cause a failure)
- $details[‘user_id’] – (integer) the ID of the user being added to the current blog
- $details[‘role’] – (string) the role to be assigned to the user in the current blog
注意
- 使用到 global $blog_id.
- 使用到 add_user_to_blog().
- 调用 动作 ‘added_existing_user’ with the user’s ID and the result returned by add_user_to_blog()
历史
添加于 版本: MU ( 3.0.0)
源文件
add_existing_user_to_blog() 函数的代码位于 wp-includes/ms-functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* 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;
}
}
|
相关
maybe_add_existing_user_to_blog(), add_user_to_blog(), remove_user_from_blog(), add_new_user_to_blog()
- 原文:http://codex.wordpress.org/Function_Reference/add_existing_user_to_blog
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!