Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/10/2018 05:05:15 PM (7 years ago)
Author:
r-a-y
Message:

Friends: Fix fatal error when the Activity component is disabled and when attempting to remove a friend.

During some refactoring to only load the Friends activity module
conditionally (r11932), a spot was missed during the remove friends
routine, causing a fatal error if the Activity component is disabled.

Props thejimmy.
Anti-props r-a-y.

See #7920 (trunk)

File:
1 edited

Legend:

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

    r11447 r12186  
    410410}
    411411add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
     412
     413/**
     414 * Remove friendship activity item when a friendship is deleted.
     415 *
     416 * @since 3.2.0
     417 *
     418 * @param int $friendship_id ID of the friendship.
     419 */
     420function bp_friends_delete_activity_on_friendship_delete( $friendship_id ) {
     421    friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_created', 'user_id' => 0 ) );
     422}
     423add_action( 'friends_friendship_deleted', 'bp_friends_delete_activity_on_friendship_delete' );
Note: See TracChangeset for help on using the changeset viewer.