Skip to:
Content

BuddyPress.org

Changeset 12186


Ignore:
Timestamp:
07/10/2018 05:05:15 PM (4 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)

Location:
trunk/src/bp-friends
Files:
2 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' );
  • trunk/src/bp-friends/bp-friends-functions.php

    r12160 r12186  
    115115     */
    116116    do_action( 'friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid );
    117 
    118     // Remove the activity stream items about the friendship id.
    119     friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_created', 'user_id' => 0 ) );
    120117
    121118    /**
Note: See TracChangeset for help on using the changeset viewer.