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
This commit is contained in:
Drew Jaynes 2014-11-28 03:48:22 +00:00
parent 9a4a968172
commit a899bbaee7
2 changed files with 7 additions and 2 deletions

View File

@ -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' );

View File

@ -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.