Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/29/2020 05:32:05 PM (6 years ago)
Author:
boonebgorges
Message:

Don't delete user data on delete_user hook on Multisite.

The new function bp_remove_user_data_on_delete_user_hook(), which defaults
to false on Multisite and true otherwise, helps BuddyPress to differentiate
between the use of wp_delete_user() to delete a user account from an
installation (typical on non-Multisite) and its use to remove a user from
a site in a Multisite instance.

Props imath.

Fixes #8175.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r12602 r12605  
    12781278}
    12791279add_action( 'wpmu_delete_user',  'bp_activity_remove_all_user_data' );
    1280 add_action( 'delete_user',       'bp_activity_remove_all_user_data' );
     1280
     1281/**
     1282 * Deletes user activity data on the 'delete_user' hook.
     1283 *
     1284 * @since 6.0.0
     1285 *
     1286 * @param int $user_id The ID of the deleted user.
     1287 */
     1288function bp_activity_remove_all_user_data_on_delete_user( $user_id ) {
     1289    if ( ! bp_remove_user_data_on_delete_user_hook( 'activity', $user_id ) ) {
     1290        return;
     1291    }
     1292
     1293    bp_activity_remove_all_user_data( $user_id );
     1294}
     1295add_action( 'delete_user', 'bp_activity_remove_all_user_data_on_delete_user' );
    12811296
    12821297/**
Note: See TracChangeset for help on using the changeset viewer.