Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2016 05:36:58 PM (8 years ago)
Author:
r-a-y
Message:

Friends: Delete 'friendship_created' activity items when a user is deleted.

Fixes #6780.

File:
1 edited

Legend:

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

    r10417 r10563  
    385385}
    386386add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
     387
     388/**
     389 * Deletes friendship activity items when a user is deleted.
     390 *
     391 * @since 2.5.0
     392 *
     393 * @param int $user_id The ID of the user being deleted.
     394 */
     395function bp_friends_delete_activity_on_user_delete( $user_id = 0 ) {
     396    if ( ! bp_is_active( 'activity' ) ) {
     397        return;
     398    }
     399
     400    bp_activity_delete( array(
     401        'component'         => buddypress()->friends->id,
     402        'type'              => 'friendship_created',
     403        'secondary_item_id' => $user_id
     404    ) );
     405}
     406add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
Note: See TracChangeset for help on using the changeset viewer.