Browse files

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.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 2a615d2 commit 4ffc5dd0f413baf460ec9e782b98b521c671a071 nacin committed Apr 27, 2012
Showing with 11 additions and 7 deletions.
  1. +3 −5 wp-admin/user-new.php
  2. +8 −2 wp-admin/users.php
View
8 wp-admin/user-new.php
@@ -98,12 +98,10 @@ function admin_created_user_subject( $text ) {
if ( is_wp_error( $user_id ) ) {
$add_user_errors = $user_id;
} else {
- if ( current_user_can('edit_users') ) {
- $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
- $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id;
- } else {
+ if ( current_user_can( 'list_users' ) )
+ $redirect = 'users.php?update=add&id=' . $user_id;
+ else
$redirect = add_query_arg( 'update', 'add', 'user-new.php' );
- }
wp_redirect( $redirect );
die();
}
View
10 wp-admin/users.php
@@ -353,10 +353,16 @@
case 'del':
case 'del_many':
$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
- $messages[] = '<div id="message" class="updated"><p>' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
+ $messages[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
break;
case 'add':
- $messages[] = '<div id="message" class="updated"><p>' . __('New user created.') . '</p></div>';
+ if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
+ $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
+ esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ),
+ self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
+ } else {
+ $messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
+ }
break;
case 'promote':
$messages[] = '<div id="message" class="updated"><p>' . __('Changed roles.') . '</p></div>';

0 comments on commit 4ffc5dd

Please sign in to comment.