[buddypress-trac] [BuddyPress] #5098: bp_settings_action_general() misses to invalidate object cache

buddypress-trac noreply at wordpress.org
Mon Jul 15 11:16:48 UTC 2013

#5098: bp_settings_action_general()  misses to invalidate object cache
 Reporter:  wpdennis      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Members       |    Version:  1.7
 Severity:  normal        |   Keywords:  dev-feedback
 If a user changes his email adress under /settings/general/ it gets
 changed in the database but the GUI shows the old email adress.

 This occurs with an '''enabled object cache'''. The reason seems to be,
 that [http://buddypress.trac.wordpress.org/browser/trunk/bp-settings/bp-
 settings-actions.php#L145 bp_settings_action_general()] just uses
 ''wp_update_user()'' but doesn't invalidate the BP specific cache key
 "'bp_core_userdata_' . $user_id".

 But [http://buddypress.trac.wordpress.org/browser/trunk/bp-members/bp-
 members-functions.php#L156 bp_core_get_core_userdata()] is used to show
 the value of the email input field. And ''bp_core_get_core_userdata()''
 loads the value of "'bp_core_userdata_' . $user_id" from object cache.

 Maybe this would solve the problem:

 // Make sure these changes are in $bp for the current page load
 if ( ( false === $email_error ) && ( false === $pass_error ) && (
 wp_update_user( $update_user ) ) ) {
     wp_cache_delete('bp_core_userdata_' . bp_displayed_user_id(), 'bp');
     $bp->displayed_user->userdata = bp_core_get_core_userdata(
 bp_displayed_user_id() );

 Do you see any issues with this or am I missing something?

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5098>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list