当前位置:首页>网络教程>WordPress开发函数add_existing_user_to_blog()

WordPress开发函数add_existing_user_to_blog()

WordPress开发函数add_existing_user_to_blog(),根据maybe_add_existing_user_to_blog()中的详细信息向博客添加用户。

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对象。如果$details数组没有提供,则为空。

更多的信息

这个函数由maybe_add_existing_user_to_blog()调用,不应该直接调用。本页仅供参考之用。使用add_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;

}

}

更新日志

WordPress开发函数add_existing_user_to_blog()

给TA打赏
共{{data.count}}人
人已打赏
网络教程

WordPress函数add_editor_style()

2022-7-15 17:03:44

网络教程

WordPress开发函数add_magic_quotes()

2022-7-15 17:04:04

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索