函数原型
maybe_add_existing_user_to_blog()
函数描述
Adds a new user to a blog by visiting /newbloguser/{key}/.
是否弃用
未弃用
函数参数
无
函数返回值
无
函数位置
File: wp-includes/ms-functions.php.
函数源码
function maybe_add_existing_user_to_blog() {
if ( false === strpos( $_SERVER['REQUEST_URI'], '/newbloguser/' ) ) {
return;
}
$parts = explode( '/', $_SERVER['REQUEST_URI'] );
$key = array_pop( $parts );
if ( '' === $key ) {
$key = array_pop( $parts );
}
$details = get_option( 'new_user_' . $key );
if ( ! empty( $details ) ) {
delete_option( 'new_user_' . $key );
}
if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) {
wp_die(
sprintf(
/* translators: %s: Home URL. */
__( 'An error occurred adding you to this site. Go to the <a href="%s">homepage</a>.' ),
home_url()
)
);
}
wp_die(
sprintf(
/* translators: 1: Home URL, 2: Admin URL. */
__( 'You have been added to this site. Please visit the <a href="%1$s">homepage</a> or <a href="%2$s">log in</a> using your username and password.' ),
home_url(),
admin_url()
),
__( 'WordPress › Success' ),
array( 'response' => 200 )
);
}
源码链接
变更日志
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |

