Ticket #35705: 35705_refreshed2.diff
File 35705_refreshed2.diff, 4.5 KB (added by , 9 years ago) |
---|
-
src/wp-admin/network/user-new.php
59 59 * @param int $user_id ID of the newly created user. 60 60 */ 61 61 do_action( 'network_user_new_created_user', $user_id ); 62 wp_redirect( add_query_arg( array('update' => 'added' ), 'user-new.php' ) );62 wp_redirect( add_query_arg( array('update' => 'added', 'userid' => $user_id ), 'user-new.php' ) ); 63 63 exit; 64 64 } 65 65 } … … 67 67 68 68 if ( isset($_GET['update']) ) { 69 69 $messages = array(); 70 if ( 'added' == $_GET['update'] ) 71 $messages[] = __('User added.'); 70 if ( 'added' == $_GET['update'] ) { 71 $edit_link = ''; 72 if ( isset( $_GET['userid'] ) ) { 73 $user_id_new = absint( $_GET['userid'] ); 74 if ( $user_id_new ) { 75 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); 76 } 77 } 78 if ( empty( $edit_link ) ) { 79 $messages[] = __('User added.'); 80 } else { 81 $messages[] = sprintf( 82 __( 'User added. <a href="%1$s">Edit User</a>' ), $edit_link 83 ); 84 } 85 } 72 86 } 73 87 74 88 $title = __('Add New User'); -
src/wp-admin/user-new.php
68 68 } else { 69 69 if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { 70 70 add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); 71 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation'), 'user-new.php' );71 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' , 'userid' => $user_id ), 'user-new.php' ); 72 72 } else { 73 73 $newuser_key = substr( md5( $user_id ), 0, 5 ); 74 74 add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); … … 148 148 if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { 149 149 $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 ) ); 150 150 wpmu_activate_signup( $key ); 151 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 151 $userid_noconfirmation = false; 152 $user_noconfirmation = get_user_by( 'email' , $new_user_email ); 153 if ( $user_noconfirmation ) { 154 if ( isset( $user_noconfirmation->ID )) { 155 $userid_noconfirmation = $user_noconfirmation->ID; 156 $userid_noconfirmation = intval( $userid_noconfirmation ); 157 } 158 } 159 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ) , 'user-new.php' ); 160 if ( $userid_noconfirmation ) { 161 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation', 'userid' => $userid_noconfirmation ), 'user-new.php' ); 162 } 163 152 164 } else { 153 $redirect = add_query_arg( array( 'update' => 'newuserconfirmation'), 'user-new.php' );165 $redirect = add_query_arg( array( 'update' => 'newuserconfirmation' ), 'user-new.php' ); 154 166 } 155 167 wp_redirect( $redirect ); 156 168 die(); … … 223 235 if ( isset($_GET['update']) ) { 224 236 $messages = array(); 225 237 if ( is_multisite() ) { 238 $edit_link = ''; 239 if ( ( isset( $_GET['userid'] )) && ( isset( $current_user->ID ))) { 240 $user_id_new = absint( $_GET['userid'] ); 241 if ( current_user_can( 'edit_user', $current_user->ID ) ) { 242 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); 243 } 244 } 226 245 switch ( $_GET['update'] ) { 227 246 case "newuserconfirmation": 228 247 $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); … … 231 250 $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); 232 251 break; 233 252 case "addnoconfirmation": 234 $messages[] = __('User has been added to your site.'); 253 if ( empty( $edit_link )) { 254 $messages[] = __('User has been added to your site.'); 255 } else { 256 $messages[] = sprintf( 257 __( 'User has been added to your site. <a href="%1$s">Edit User</a>' ), $edit_link 258 ); 259 } 235 260 break; 236 261 case "addexisting": 237 262 $messages[] = __('That user is already a member of this site.');