Index: src/wp-admin/network/user-new.php
===================================================================
--- src/wp-admin/network/user-new.php (revision 36570)
+++ src/wp-admin/network/user-new.php (working copy)
@@ -59,7 +59,7 @@
* @param int $user_id ID of the newly created user.
*/
do_action( 'network_user_new_created_user', $user_id );
- wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
+ wp_redirect( add_query_arg( array('update' => 'added','userid' =>$user_id), 'user-new.php' ) );
exit;
}
}
@@ -67,8 +67,22 @@
if ( isset($_GET['update']) ) {
$messages = array();
- if ( 'added' == $_GET['update'] )
- $messages[] = __('User added.');
+ if ( 'added' == $_GET['update'] ) {
+ $edit_link='';
+ if (isset($_GET['userid'])) {
+ $user_id_new=absint( $_GET['userid'] );
+ if ($user_id_new > 0) {
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) );
+ }
+ }
+ if (empty($edit_link)) {
+ $messages[] = __('User added.');
+ } else {
+ $messages[] = sprintf(
+ __( 'User added. Edit User' ), $edit_link
+ );
+ }
+ }
}
$title = __('Add New User');
Index: src/wp-admin/user-new.php
===================================================================
--- src/wp-admin/user-new.php (revision 36570)
+++ src/wp-admin/user-new.php (working copy)
@@ -68,7 +68,7 @@
} else {
if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
- $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+ $redirect = add_query_arg( array('update' => 'addnoconfirmation','userid'=>$user_id), 'user-new.php' );
} else {
$newuser_key = substr( md5( $user_id ), 0, 5 );
add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
@@ -148,7 +148,19 @@
if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
$key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) );
wpmu_activate_signup( $key );
+ $userid_noconfirmation = 0;
+ $user_noconfirmation= get_user_by('email',$new_user_email);
+ if ($user_noconfirmation) {
+ if (isset($user_noconfirmation->ID)) {
+ $userid_noconfirmation = $user_noconfirmation->ID;
+ $userid_noconfirmation = intval($userid_noconfirmation);
+ }
+ }
$redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+ if ($userid_noconfirmation > 0) {
+ $redirect = add_query_arg( array('update' => 'addnoconfirmation','userid' =>$userid_noconfirmation), 'user-new.php' );
+ }
+
} else {
$redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' );
}
@@ -223,6 +235,14 @@
if ( isset($_GET['update']) ) {
$messages = array();
if ( is_multisite() ) {
+ $edit_link='';
+ if ((isset($_GET['userid'])) && (isset($current_user->ID))) {
+ $user_id_new=absint( $_GET['userid'] );
+ $current_user_id=$current_user->ID;
+ if ( current_user_can( 'edit_user', $current_user_id ) ) {
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) );
+ }
+ }
switch ( $_GET['update'] ) {
case "newuserconfirmation":
$messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.');
@@ -231,7 +251,13 @@
$messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.');
break;
case "addnoconfirmation":
- $messages[] = __('User has been added to your site.');
+ if (empty($edit_link)) {
+ $messages[] = __('User has been added to your site.');
+ } else {
+ $messages[] = sprintf(
+ __( 'User has been added to your site. Edit User' ), $edit_link
+ );
+ }
break;
case "addexisting":
$messages[] = __('That user is already a member of this site.');