From 26e30b84c6e90891bdee892558d780671dd594bd Mon Sep 17 00:00:00 2001
From: Kalpesh <kalpesh@xecurify.com>
Date: Thu, 9 Feb 2023 01:50:15 +0530
Subject: [PATCH] Empty nicename check fix after sanitize_user to avoid
creating user with empty nicename
---
src/wp-includes/user.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 018c960c031b..892f33cea43f 100644
|
a
|
b
|
function wp_insert_user( $userdata ) { |
| 1855 | 1855 | * If a nicename is provided, remove unsafe user characters before using it. |
| 1856 | 1856 | * Otherwise build a nicename from the user_login. |
| 1857 | 1857 | */ |
| 1858 | | if ( ! empty( $userdata['user_nicename'] ) ) { |
| | 1858 | if ( ! empty( sanitize_user( $userdata['user_nicename'], true ) ) ) { |
| 1859 | 1859 | $user_nicename = sanitize_user( $userdata['user_nicename'], true ); |
| 1860 | 1860 | if ( mb_strlen( $user_nicename ) > 50 ) { |
| 1861 | 1861 | return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) ); |