From e1ffe72def2bbdcec20bdcfe769b0c4a7249412a Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 1 Jan 2011 22:30:46 +0000 Subject: [PATCH] Allow us to return from whence we came. Specify wp_http_referer for user-edit in the network admin, as we may come from network/users or site-users. props PeteMall, SergeyBiryukov, fixes #16053. git-svn-id: https://develop.svn.wordpress.org/trunk@17201 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/class-wp-ms-users-list-table.php | 10 +++++++--- wp-admin/user-edit.php | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index da07f35056..c3bfec28e0 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -171,17 +171,21 @@ class WP_MS_Users_List_Table extends WP_List_Table { case 'username': $avatar = get_avatar( $user->user_email, 32 ); - $edit_link = ( get_current_user_id() == $user->ID ) ? 'profile.php' : 'user-edit.php?user_id=' . $user->ID; + if ( get_current_user_id() == $user->ID ) { + $edit_link = esc_url( network_admin_url( 'profile.php' ) ); + } else { + $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user->ID ) ) ); + } echo ""; ?> - user_login ); ?>user_login ); ?>user_login, $super_admins ) ) echo ' - ' . __( 'Super Admin' ); ?>
' . __( 'Edit' ) . ''; + $actions['edit'] = '' . __( 'Edit' ) . ''; if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) { $actions['delete'] = '' . __( 'Delete' ) . ''; diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index a804f8264c..c3276d6930 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -147,7 +147,8 @@ if ( !is_multisite() ) { if ( !is_wp_error( $errors ) ) { $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true"; - $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); + if ( $wp_http_referer ) + $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); wp_redirect($redirect); exit; } @@ -168,7 +169,7 @@ include (ABSPATH . 'wp-admin/admin-header.php');

-

+