Make WordPress Core

Changeset 20631


Ignore:
Timestamp:
04/27/2012 11:13:39 PM (12 years ago)
Author:
nacin
Message:

After adding a user, take them back to users.php with an 'Edit user' link in the message.

This removes the (possibly ineffective) search from the redirect, as well as the URL hash that will get covered up by the toolbar.

fixes #19470. props merty and SergeyBiryukov for initial patches.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-new.php

    r20332 r20631  
    9999            $add_user_errors = $user_id;
    100100        } else {
    101             if ( current_user_can('edit_users') ) {
    102                 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
    103                 $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id;
    104             } else {
     101            if ( current_user_can( 'list_users' ) )
     102                $redirect = 'users.php?update=add&id=' . $user_id;
     103            else
    105104                $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
    106             }
    107105            wp_redirect( $redirect );
    108106            die();
  • trunk/wp-admin/users.php

    r20332 r20631  
    354354        case 'del_many':
    355355            $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
    356             $messages[] = '<div id="message" class="updated"><p>' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
     356            $messages[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
    357357            break;
    358358        case 'add':
    359             $messages[] = '<div id="message" class="updated"><p>' . __('New user created.') . '</p></div>';
     359            if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
     360                $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
     361                    esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ),
     362                        self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
     363            } else {
     364                $messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
     365            }
    360366            break;
    361367        case 'promote':
Note: See TracChangeset for help on using the changeset viewer.