diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/user-new.php --- a/wp/wp-admin/user-new.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/user-new.php Tue Dec 15 13:49:49 2020 +0100 @@ -7,7 +7,7 @@ */ /** WordPress Administration Bootstrap */ -require_once( dirname( __FILE__ ) . '/admin.php' ); +require_once __DIR__ . '/admin.php'; if ( is_multisite() ) { if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) { @@ -29,7 +29,7 @@ add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); } -if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) { +if ( isset( $_REQUEST['action'] ) && 'adduser' === $_REQUEST['action'] ) { check_admin_referer( 'add-user', '_wpnonce_add-user' ); $user_details = null; @@ -58,12 +58,12 @@ ); } - // Adding an existing user to this blog + // Adding an existing user to this blog. $new_user_email = $user_details->user_email; $redirect = 'user-new.php'; $username = $user_details->user_login; $user_id = $user_details->ID; - if ( $username != null && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) { + if ( null != $username && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) { $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' ); } else { if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) { @@ -105,14 +105,14 @@ * @since 4.4.0 * * @param int $user_id The invited user's ID. - * @param array $role The role of invited user. + * @param array $role Array containing role information for the invited user. * @param string $newuser_key The key of the invitation. */ do_action( 'invite_user', $user_id, $role, $newuser_key ); $switched_locale = switch_to_locale( get_user_locale( $user_details ) ); - /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ + /* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */ $message = __( 'Hi, @@ -123,8 +123,21 @@ %4$s' ); - /* translators: Joining confirmation notification email subject. %s: Site title */ - wp_mail( $new_user_email, sprintf( __( '[%s] Joining Confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); + wp_mail( + $new_user_email, + sprintf( + /* translators: Joining confirmation notification email subject. %s: Site title. */ + __( '[%s] Joining Confirmation' ), + wp_specialchars_decode( get_option( 'blogname' ) ) + ), + sprintf( + $message, + get_option( 'blogname' ), + home_url(), + wp_specialchars_decode( translate_user_role( $role['name'] ) ), + home_url( "/newbloguser/$newuser_key/" ) + ) + ); if ( $switched_locale ) { restore_previous_locale(); @@ -135,7 +148,7 @@ } wp_redirect( $redirect ); die(); -} elseif ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) { +} elseif ( isset( $_REQUEST['action'] ) && 'createuser' === $_REQUEST['action'] ) { check_admin_referer( 'create-user', '_wpnonce_create-user' ); if ( ! current_user_can( 'create_users' ) ) { @@ -161,7 +174,7 @@ die(); } } else { - // Adding a new user to this site + // Adding a new user to this site. $new_user_email = wp_unslash( $_REQUEST['email'] ); $user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email ); if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) { @@ -170,8 +183,8 @@ /** This filter is documented in wp-includes/user.php */ $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) { - add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email - add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email + add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email. + add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email. } wpmu_signup_user( $new_user_login, @@ -240,19 +253,19 @@ 'id' => 'user-roles', 'title' => __( 'User Roles' ), 'content' => '

' . __( 'Here is a basic overview of the different user roles and the permissions associated with each one:' ) . '

' . - '', + '', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Adding New Users' ) . '

' . + '

' . __( 'Documentation on Adding New Users' ) . '

' . '

' . __( 'Support' ) . '

' ); @@ -272,7 +285,7 @@ wp_enqueue_script( 'user-suggest' ); } -require_once( ABSPATH . 'wp-admin/admin-header.php' ); +require_once ABSPATH . 'wp-admin/admin-header.php'; if ( isset( $_GET['update'] ) ) { $messages = array(); @@ -293,12 +306,13 @@ $messages[] = __( 'Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.' ); break; case 'addnoconfirmation': - if ( empty( $edit_link ) ) { - $messages[] = __( 'User has been added to your site.' ); - } else { - /* translators: %s: edit page url */ - $messages[] = sprintf( __( 'User has been added to your site. Edit user' ), $edit_link ); + $message = __( 'User has been added to your site.' ); + + if ( $edit_link ) { + $message .= sprintf( ' %s', $edit_link, __( 'Edit user' ) ); } + + $messages[] = $message; break; case 'addexisting': $messages[] = __( 'That user is already a member of this site.' ); @@ -317,7 +331,7 @@ break; } } else { - if ( 'add' == $_GET['update'] ) { + if ( 'add' === $_GET['update'] ) { $messages[] = __( 'User added.' ); } } @@ -413,7 +427,7 @@ - + 'addusersub' ) ); ?> + + + + + + + 'locale', + 'id' => 'locale', + 'selected' => 'site-default', + 'languages' => $languages, + 'show_available_translations' => false, + 'show_option_site_default' => true, + ) + ); + ?> + + +