maybe_add_existing_user_to_blog()
最后更新于:2021-11-27 14:41:24
maybe_add_existing_user_to_blog()Add a new user to a blog by visiting /newbloguser/{key}/.
源文件
文件: gc-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_gc_error( add_existing_user_to_blog( $details ) ) ) {
gc_die(
sprintf(
/* translators: %s: Home URL. */
__( 'An error occurred adding you to this site. Go to the <a href="https://docs.gechiui.com/functions/maybe_add_existing_user_to_blog/%s">homepage</a>.' ),
home_url()
)
);
}
gc_die(
sprintf(
/* translators: 1: Home URL, 2: Admin URL. */
__( 'You have been added to this site. Please visit the <a href="https://docs.gechiui.com/functions/maybe_add_existing_user_to_blog/%1$s">homepage</a> or <a href="https://docs.gechiui.com/functions/maybe_add_existing_user_to_blog/%2$s">log in</a> using your username and password.' ),
home_url(),
admin_url()
),
__( 'GeChiUI › Success' ),
array( 'response' => 200 )
);
}