[wp-trac] [WordPress Trac] #57635: Check if empty user_nicename in the function wp_insert_user
WordPress Trac
noreply at wordpress.org
Wed Feb 8 19:21:49 UTC 2023
#57635: Check if empty user_nicename in the function wp_insert_user
-------------------------------------------------+-------------------------
Reporter: missveronicatv | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
| Release
Component: Users | Version: 6.1.1
Severity: normal | Resolution:
Keywords: needs-patch good-first-bug needs- | Focuses:
testing-info |
-------------------------------------------------+-------------------------
Changes (by kalpeshh):
* keywords: needs-patch good-first-bug => needs-patch good-first-bug
needs-testing-info
Comment:
I could not reproduce this and I can see that empty 'user_nicename' is
already handled in `wp_insert_user` function
{{{
/*
* If a nicename is provided, remove unsafe user characters before
using it.
* Otherwise build a nicename from the user_login.
*/
if ( ! empty( $userdata['user_nicename'] ) ) {
$user_nicename = sanitize_user(
$userdata['user_nicename'], true );
} else {
$user_nicename = mb_substr( $user_login, 0, 50 );
}
}}}
To reproduce exception you mentioned, I had to change value of
`user_nicename` to empty manually from database.
@missveronicatv can you please provide steps to reproduce this? I couldn't
reproduce with below.
{{{
$userdata = array(
'user_login' => 'login_name',
'user_url' => 'https://example.com',
'user_pass' => 'password',
'user_nicename' => ''
);
$user_id = wp_insert_user( $userdata );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57635#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list