Login and Registration: Introduce a `username_exists` filter, which allows for control over registration of usernames.

Props shamim51

Fixes #39320

Built from https://develop.svn.wordpress.org/trunk@41158


git-svn-id: http://core.svn.wordpress.org/trunk@40998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2017-07-26 16:25:40 +00:00
parent c7feb8387a
commit 6b22dbe59a
2 changed files with 14 additions and 3 deletions

View File

@ -1320,9 +1320,20 @@ function clean_user_cache( $user ) {
*/
function username_exists( $username ) {
if ( $user = get_user_by( 'login', $username ) ) {
return $user->ID;
$user_id = $user->ID;
} else {
$user_id = false;
}
return false;
/**
* Filters whether the given username exists or not.
*
* @since 4.9.0
*
* @param int|false $user_id The user's ID on success, and false on failure.
* @param string $username Username to check.
*/
return apply_filters( 'username_exists', $user_id, $username );
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41157';
$wp_version = '4.9-alpha-41158';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.