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-notifications/bp-notifications-functions.php

    r12602 r12605  
    446446}
    447447add_action( 'wpmu_delete_user', 'bp_notifications_delete_notifications_on_user_delete' );
    448 add_action( 'delete_user', 'bp_notifications_delete_notifications_on_user_delete' );
     448
     449/**
     450 * Deletes user notifications data on the 'delete_user' hook.
     451 *
     452 * @since 6.0.0
     453 *
     454 * @param int $user_id The ID of the deleted user.
     455 */
     456function bp_notifications_delete_notifications_on_delete_user( $user_id ) {
     457    if ( ! bp_remove_user_data_on_delete_user_hook( 'notifications', $user_id ) ) {
     458        return;
     459    }
     460
     461    bp_notifications_delete_notifications_on_user_delete( $user_id );
     462}
     463
     464add_action( 'delete_user', 'bp_notifications_delete_notifications_on_delete_user' );
    449465
    450466/** Mark **********************************************************************/
Note: See TracChangeset for help on using the changeset viewer.