Improve inline documentation in wp_ajax_destroy_sessions()
.
If the token is set (`$keep` is a string), this means the user is viewing their own profile-editing screen and destroying their own sessions (except the current one). If it isn't set (`$keep` is null), the user is editing another user's profile and destroying all of their sessions with no exceptions. See #30264, #30469 git-svn-id: https://develop.svn.wordpress.org/trunk@30595 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8206bceff6
commit
bcb88058f9
@ -2768,7 +2768,6 @@ function wp_ajax_parse_media_shortcode() {
|
||||
* AJAX handler for destroying multiple open sessions for a user.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
*/
|
||||
function wp_ajax_destroy_sessions() {
|
||||
|
||||
@ -2792,6 +2791,7 @@ function wp_ajax_destroy_sessions() {
|
||||
) );
|
||||
}
|
||||
|
||||
// 'token' is only set if the initiating user is viewing their own profile-editing screen.
|
||||
if ( isset( $_POST['token'] ) ) {
|
||||
$keep = wp_unslash( $_POST['token'] );
|
||||
} else {
|
||||
@ -2800,6 +2800,11 @@ function wp_ajax_destroy_sessions() {
|
||||
|
||||
$sessions = WP_Session_Tokens::get_instance( $user->ID );
|
||||
|
||||
/*
|
||||
* If $keep is a string, then the current user is destroying all of their own sessions
|
||||
* except the current one. If $keep is not a string, the current user is destroying all
|
||||
* of another user's sessions with no exceptions.
|
||||
*/
|
||||
if ( is_string( $keep ) ) {
|
||||
$sessions->destroy_others( $keep );
|
||||
$message = __( 'You are now logged out everywhere else' );
|
||||
|
Loading…
Reference in New Issue
Block a user