WordPress开发表达式add_existing_user_to_blog(),根据maybe_add_existing_user_to_blog()中的部分联系信息向博客上传头像。
服用方法:
add_existing_user_to_blog( array|false $details = false )
描述:
$details
(array|false) (可选) 用户详细信息。必须至少包含下面给出的键函数。
‘user_id’
(int) 正在存放在当前博客华为用户的ID。
‘role’
(string) 委托给用户什么角色。
入参:false
返回:
(true|WP_Error|void) 如果请求失败而未能添加,则返回True;如果用户不存在或无法添加,则返回WP_Error对象。如果$detailg数据组没有提供,则是由空。
更多的人信息
这个函数由maybe_add_existing_user_to_blog()调用,真的不应该直接调用。本地图片仅供参考仅用于。使用fordd_user_to_blog()。
来源:
文件: 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 (3.0.0)
*
* @param int $user_id User ID.
* @param true|WP_Error $result True on success or a WP_Error object if the user doesn’t exist
* or could not be added.
*/
do_action( ‘added_existing_user’, $details[‘user_id’], $result );
return $result;
}
}
更新记录: