Users: Use email_exists()
in send_confirmation_on_profile_email()
, instead of a manual query.
This gives us caching, and removes the use of the `$wpdb` global. Props spacedmonkey, pento. Fixes #45748. git-svn-id: https://develop.svn.wordpress.org/trunk@44465 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
19e46911cf
commit
cfbb2e735f
@ -2692,10 +2692,9 @@ function _wp_get_current_user() {
|
|||||||
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
|
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
|
||||||
*
|
*
|
||||||
* @global WP_Error $errors WP_Error object.
|
* @global WP_Error $errors WP_Error object.
|
||||||
* @global wpdb $wpdb WordPress database object.
|
|
||||||
*/
|
*/
|
||||||
function send_confirmation_on_profile_email() {
|
function send_confirmation_on_profile_email() {
|
||||||
global $errors, $wpdb;
|
global $errors;
|
||||||
|
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
if ( ! is_object( $errors ) ) {
|
if ( ! is_object( $errors ) ) {
|
||||||
@ -2719,7 +2718,7 @@ function send_confirmation_on_profile_email() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
|
if ( email_exists( $_POST['email'] ) ) {
|
||||||
$errors->add(
|
$errors->add(
|
||||||
'user_email',
|
'user_email',
|
||||||
__( '<strong>ERROR</strong>: The email address is already used.' ),
|
__( '<strong>ERROR</strong>: The email address is already used.' ),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user