Skip to:

#7050 closed defect (bug) (fixed)

Need to clear user cache after running direct query to update user displayname

Reported by: prettyboymp Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: Extended Profile Keywords: needs-patch needs-unit-tests


The xprofile_sync_wp_profile() function runs a direct query to update the user's display name. clean_user_cache($user_id) needs to be called after that query or the change will never show if object cache is being used.


Change History (5)

#1 @johnjamesjacoby
21 months ago

  • Component changed from API to Component - XProfile
  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned


We do clean other caches in bp-xprofile-cache.php but the core user objects are missed.

Plausible there's more tuning required, as many of our cache busting actions are hooked at priority 10 with other functions that are also hooked at 10, but maybe too-soon or too-late depending on the context.

Last edited 21 months ago by johnjamesjacoby (previous) (diff)

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.

20 months ago

This ticket was mentioned in Slack in #buddypress by jjj. View the logs.

20 months ago

#4 @johnjamesjacoby
20 months ago

This is important enough to fit into 2.6 during the beta period, and will be a small enough code change that my confidence level that it will not cause additional breakage is very high.

#5 @djpaul
20 months ago

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

In 10857:

xprofile: remove direct SQL query when syncing BP profile to WP, and clear BP user cache.

When the user updates their profile name, and xprofile syncing is enabled (the default), we update the display_name property of the WordPress user. We remove the direct query to help prevent WordPress having a stale cache.

We also need to clear our own legacy user cache object so that bp_displayed_user_fullname returns accurate data.

Fixes #7050

Note: See TracTickets for help on using tickets.