mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-05 18:35:46 +03:00
Contributors: Reset profile hours when pledge deactivated.
See https://github.com/WordPress/five-for-the-future/issues/169
This commit is contained in:
parent
834c62c0d0
commit
c6d7bbb7c1
6 changed files with 338 additions and 4 deletions
|
@ -170,3 +170,21 @@ function get_contributor_user_data( $user_id ) {
|
|||
|
||||
return $formatted_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the 5ftF data on a user's profile.
|
||||
*/
|
||||
function reset_contribution_data( $user_id ) : void {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query( $wpdb->prepare( '
|
||||
DELETE FROM `bpmain_bp_xprofile_data`
|
||||
WHERE
|
||||
user_id = %d AND
|
||||
field_id IN ( %d, %d, %d )',
|
||||
$user_id,
|
||||
FIELD_IDS['sponsored'],
|
||||
FIELD_IDS['hours_per_week'],
|
||||
FIELD_IDS['team_names'],
|
||||
) );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue