Ticket #35705: 35705.4.diff
File 35705.4.diff, 5.2 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', 'user_id' => $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['user_id'] ) ) { 73 $user_id_new = absint( $_GET['user_id'] ); 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 79 if ( empty( $edit_link ) ) { 80 $messages[] = __( 'User added.' ); 81 } else { 82 $messages[] = sprintf( __( 'User added. <a href="%1$s">Edit User</a>' ), $edit_link ); 83 } 84 } 72 85 } 73 86 74 87 $title = __('Add New User'); -
src/wp-admin/user-edit.php
55 55 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 56 56 ); 57 57 58 $wp_http_referer = remove_query_arg( array('update', 'delete_count'), $wp_http_referer );58 $wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer ); 59 59 60 60 $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); 61 61 … … 179 179 <?php else: ?> 180 180 <p><strong><?php _e('User updated.') ?></strong></p> 181 181 <?php endif; ?> 182 <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>182 <?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?> 183 183 <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('← Back to Users'); ?></a></p> 184 184 <?php endif; ?> 185 185 </div> -
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' , 'user_id' => $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' ] ) ); … … 147 147 wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_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 wpmu_activate_signup( $key ); 151 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 150 $new_user = wpmu_activate_signup( $key ); 151 if ( ! is_wp_error( $new_user ) ) { 152 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' ); 153 } else { 154 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation', 'user_id' => $new_user['user_id'] ), 'user-new.php' ); 155 } 152 156 } else { 153 157 $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' ); 154 158 } … … 223 227 if ( isset($_GET['update']) ) { 224 228 $messages = array(); 225 229 if ( is_multisite() ) { 230 $edit_link = ''; 231 if ( ( isset( $_GET['user_id'] ) ) ) { 232 $user_id_new = absint( $_GET['user_id'] ); 233 if ( $user_id_new ) { 234 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); 235 } 236 } 237 226 238 switch ( $_GET['update'] ) { 227 239 case "newuserconfirmation": 228 240 $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); … … 231 243 $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); 232 244 break; 233 245 case "addnoconfirmation": 234 $messages[] = __('User has been added to your site.'); 246 if ( empty( $edit_link ) ) { 247 $messages[] = __( 'User has been added to your site.' ); 248 } else { 249 $messages[] = sprintf( __( 'User has been added to your site. <a href="%1$s">Edit User</a>' ), $edit_link ); 250 } 235 251 break; 236 252 case "addexisting": 237 253 $messages[] = __('That user is already a member of this site.');