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
This commit is contained in:
parent
bce405d0f2
commit
e1ffe72def
@ -171,17 +171,21 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
case 'username':
|
case 'username':
|
||||||
$avatar = get_avatar( $user->user_email, 32 );
|
$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 "<td $attributes>"; ?>
|
echo "<td $attributes>"; ?>
|
||||||
<?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
|
<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
|
||||||
if ( in_array( $user->user_login, $super_admins ) )
|
if ( in_array( $user->user_login, $super_admins ) )
|
||||||
echo ' - ' . __( 'Super Admin' );
|
echo ' - ' . __( 'Super Admin' );
|
||||||
?></strong>
|
?></strong>
|
||||||
<br/>
|
<br/>
|
||||||
<?php
|
<?php
|
||||||
$actions = array();
|
$actions = array();
|
||||||
$actions['edit'] = '<a href="' . esc_url( self_admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>';
|
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||||
|
|
||||||
if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) {
|
if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) {
|
||||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||||
|
@ -147,6 +147,7 @@ if ( !is_multisite() ) {
|
|||||||
|
|
||||||
if ( !is_wp_error( $errors ) ) {
|
if ( !is_wp_error( $errors ) ) {
|
||||||
$redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
|
$redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
|
||||||
|
if ( $wp_http_referer )
|
||||||
$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
|
$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
|
||||||
wp_redirect($redirect);
|
wp_redirect($redirect);
|
||||||
exit;
|
exit;
|
||||||
@ -168,7 +169,7 @@ include (ABSPATH . 'wp-admin/admin-header.php');
|
|||||||
<div id="message" class="updated">
|
<div id="message" class="updated">
|
||||||
<p><strong><?php _e('User updated.') ?></strong></p>
|
<p><strong><?php _e('User updated.') ?></strong></p>
|
||||||
<?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
|
<?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
|
||||||
<p><a href="users.php"><?php _e('← Back to Authors and Users'); ?></a></p>
|
<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('← Back to Authors and Users'); ?></a></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user