mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-16 16:43:42 +03:00
Contributors: Clear object cache when resetting profile data.
BuddyPress sets it infinitely, so for some users it would be awhile before it would be pushed out organically.
This commit is contained in:
parent
c6d7bbb7c1
commit
428cde283c
|
@ -173,6 +173,9 @@ function get_contributor_user_data( $user_id ) {
|
|||
|
||||
/**
|
||||
* Reset the 5ftF data on a user's profile.
|
||||
*
|
||||
* This deletes directly from the database and object cache -- rather than using something like
|
||||
* `BP_XProfile_Field::delete()` -- because w.org/5 runs on a different network than profiles.w.org.
|
||||
*/
|
||||
function reset_contribution_data( $user_id ) : void {
|
||||
global $wpdb;
|
||||
|
@ -187,4 +190,14 @@ function reset_contribution_data( $user_id ) : void {
|
|||
FIELD_IDS['hours_per_week'],
|
||||
FIELD_IDS['team_names'],
|
||||
) );
|
||||
|
||||
wp_cache_add_global_groups( 'bp_xprofile_data' );
|
||||
wp_cache_delete_multiple(
|
||||
array(
|
||||
$user_id . ':' . FIELD_IDS['sponsored'],
|
||||
$user_id . ':' . FIELD_IDS['hours_per_week'],
|
||||
$user_id . ':' . FIELD_IDS['team_names'],
|
||||
),
|
||||
'bp_xprofile_data'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue