Since the release of WordPress 3.3, I noticed something that was overlooked when adding a new user in the wp-admin. Before, adding a new user would redirect to a list view after the user was created that only included the new user. Now it redirects back to the full user list, though it’s actually trying to display just that one new user. The problem is that they seemed to have removed the functionality of the usersearch
parameter from the URL string. It has been replaced with the usual s
that is used in the front end WordPress search. I wrote a little fix that can be added to your functions.php file in order to bring back the old behaviour:
add_action("admin_init", "redirect_user_add"); function redirect_user_add() { if(!empty($_GET['usersearch'])) { $username = $_GET['usersearch']; $user = get_userdatabylogin($username); wp_redirect(admin_url("/users.php?s=".$username."&update=add#user-".$user->ID)); } }
With this in place, you’ll now be redirected to the user list page with only the new user’s account listed. You can even modify it slightly so that it opens up the user’s profile edit page instead.
add_action("admin_init", "redirect_user_add"); function redirect_user_add() { if(!empty($_GET['usersearch'])) { $username = $_GET['usersearch']; $user = get_userdatabylogin($username); wp_redirect( admin_url("/user-edit.php?user_id=".$user->ID) ); } }
This is useful if you have added customized user fields that need to be set immediately after adding a new user.