WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 3 months ago

#47021 closed defect (bug) (fixed)

Use clean_user_cache in more places.

Reported by: spacedmonkey Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.1
Component: Users Keywords: has-patch commit
Focuses: Cc:
PR Number:

Description

There are a number of places in core that should use the clean_user_cache function. This so all caches are correctly cleared / invalidated and the clean_user_cache action is fired.

Attachments (3)

47021.diff (1.6 KB) - added by spacedmonkey 6 months ago.
47021.2.diff (1.7 KB) - added by spacedmonkey 6 months ago.
47021.3.diff (2.0 KB) - added by spacedmonkey 6 months ago.

Download all attachments as: .zip

Change History (9)

@spacedmonkey
6 months ago

#1 @mukesh27
6 months ago

@spacedmonkey, In wp-includes/user.php file, wp_update_user function can we also remove below code with new code.

wp_cache_delete( $user['user_email'], 'useremail' );
wp_cache_delete( $user['user_nicename'], 'userslugs' );

Replace with new below code

clean_user_cache( $ID );
Last edited 6 months ago by mukesh27 (previous) (diff)

#2 @spacedmonkey
6 months ago

  • Milestone changed from Awaiting Review to Future Release

Good catch @mukesh27

I have updated the patch with 47021.3.diff. I did some testing and ran the unit tests. Tests pass.

#3 @spacedmonkey
5 months ago

  • Milestone changed from Future Release to 5.3

#4 @SergeyBiryukov
5 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @SergeyBiryukov
5 months ago

  • Keywords commit added

#6 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45715:

Users: Use clean_user_cache() in wp_insert_user(), wp_update_user(), wp_set_password(), add_user_to_blog().

Props spacedmonkey.
Fixes #47021.

Note: See TracTickets for help on using tickets.