From a899bbaee7e705dffdaabbf10ed42b4c0a9233c5 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Fri, 28 Nov 2014 03:48:22 +0000 Subject: [PATCH] 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 Built from https://develop.svn.wordpress.org/trunk@30595 git-svn-id: http://core.svn.wordpress.org/trunk@30585 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 36cb488be8..90982d3302 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -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' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3a380b63ec..205a611a51 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-beta2-30594'; +$wp_version = '4.1-beta2-30595'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.