Make WordPress Core


Ignore:
Timestamp:
10/17/2022 04:53:54 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Users: Revert use of shared objects for current user.

Reverts [50790].

Props oztaser, ravipatel, dd32, costdev, SergeyBiryukov, tykoted, cu121, xknown.
Merges [54397] to the 6.0 branch.
Fixes #54984.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/user.php

    r53179 r54544  
    18551855 * @since 3.0.0
    18561856 * @since 4.4.0 'clean_user_cache' action was added.
    1857  * @since 5.8.0 Refreshes the global user instance if cleaning the user cache for the current user.
    1858  *
    1859  * @global WP_User $current_user The current user object which holds the user data.
    18601857 *
    18611858 * @param WP_User|int $user User object or ID to be cleaned from the cache
    18621859 */
    18631860function clean_user_cache( $user ) {
    1864     global $current_user;
    1865 
    18661861    if ( is_numeric( $user ) ) {
    18671862        $user = new WP_User( $user );
     
    18861881     */
    18871882    do_action( 'clean_user_cache', $user->ID, $user );
    1888 
    1889     // Refresh the global user instance if the cleaning current user.
    1890     if ( get_current_user_id() === (int) $user->ID ) {
    1891         $user_id      = (int) $user->ID;
    1892         $current_user = null;
    1893         wp_set_current_user( $user_id, '' );
    1894     }
    18951883}
    18961884
Note: See TracChangeset for help on using the changeset viewer.