Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47021 closed defect (bug) (fixed)

Use clean_user_cache in more places.

Reported by: spacedmonkey's profile spacedmonkey Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.1
Component: Users Keywords: has-patch commit
Focuses: Cc:

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 5 years ago.
47021.2.diff (1.7 KB) - added by spacedmonkey 5 years ago.
47021.3.diff (2.0 KB) - added by spacedmonkey 5 years ago.

Download all attachments as: .zip

Change History (9)

@spacedmonkey
5 years ago

@spacedmonkey
5 years ago

#1 @mukesh27
5 years 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 5 years ago by mukesh27 (previous) (diff)

@spacedmonkey
5 years ago

#2 @spacedmonkey
5 years 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 years ago

  • Milestone changed from Future Release to 5.3

#4 @SergeyBiryukov
5 years ago

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

#5 @SergeyBiryukov
5 years ago

  • Keywords commit added

#6 @SergeyBiryukov
5 years 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.