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: http://svn.automattic.com/wordpress/trunk@17201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
53d0af84b0
commit
f15b1ad05d
|
@ -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 "<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 ) )
|
||||
echo ' - ' . __( 'Super Admin' );
|
||||
?></strong>
|
||||
<br/>
|
||||
<?php
|
||||
$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 ) ) {
|
||||
$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,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');
|
|||
<div id="message" class="updated">
|
||||
<p><strong><?php _e('User updated.') ?></strong></p>
|
||||
<?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; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Reference in New Issue