Make WordPress Core


Ignore:
Timestamp:
05/24/2021 07:58:13 PM (3 years ago)
Author:
desrosj
Message:

General: Avoid unnecessary calls to update_user_option().

The update_user_option() function is a way to update a user meta value after adding a blog’s prefix to the beginning of the meta key. But when the fourth parameter is true, the behavior is exactly the same as calling update_user_meta() directly.

This replaces all instances of update_user_option() when the fourth parameter is true in Core with a direct call to update_user_meta() to prevent an unnecessary call to update_user_option().

Props johnjamesjacoby, zkancs, obenland, desrosj.
Fixes #43339.

File:
1 edited

Legend:

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

    r49764 r50981  
    8989            $message       = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' );
    9090            $user_id       = wp_create_user( $user_name, $user_password, $user_email );
    91             update_user_option( $user_id, 'default_password_nag', true, true );
     91            update_user_meta( $user_id, 'default_password_nag', true );
    9292            $email_password = true;
    9393            $user_created   = true;
Note: See TracChangeset for help on using the changeset viewer.