WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/08/2019 06:06:04 AM (6 months ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r43623 r44465  
    26932693 *
    26942694 * @global WP_Error $errors WP_Error object.
    2695  * @global wpdb     $wpdb   WordPress database object.
    26962695 */
    26972696function send_confirmation_on_profile_email() {
    2698     global $errors, $wpdb;
     2697    global $errors;
    26992698
    27002699    $current_user = wp_get_current_user();
     
    27202719        }
    27212720
    2722         if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
     2721        if ( email_exists( $_POST['email'] ) ) {
    27232722            $errors->add(
    27242723                'user_email',
Note: See TracChangeset for help on using the changeset viewer.