diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index ccae15ff26..273fa00a26 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -111,12 +111,19 @@ Please click the following link to confirm the invite: die(); } } else { - // Adding a new user to this blog + // Adding a new user to this site $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] ); if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { $add_user_errors = $user_details[ 'errors' ]; } else { - $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true)); + /** + * Filter the user_login, aka the username, before it is added to the site. + * + * @since 3.0.0 + * + * @param string $_REQUEST['user_login'] The sanitized username. + */ + $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email } @@ -181,6 +188,13 @@ get_current_screen()->set_help_sidebar( wp_enqueue_script('wp-ajax-response'); wp_enqueue_script('user-profile'); +/** + * Allows you to enable user auto-complete for non-super admins in multisite. + * + * @since 3.4.0 + * + * @param bool True or false, based on if you enable auto-complete for non-super admins. Default is false. + */ if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) ) { @@ -266,6 +280,13 @@ if ( is_multisite() ) { $label = __('E-mail or Username'); } ?> +