Skip to:
Content
Pages
Categories
Search
Top
Bottom

call function when friendship is accepted or deleted.

  • Profile photo of CommonEasy
    CommonEasy
    Participant

    @commoneasy

    Hi there,

    I have a function my_function() which i want to perform when a friendship is accepted or removed.
    I hope that somebody can tell me how to add this function to these actions.

    many thanks in advance,

    greetz,
    CommonEasy

Viewing 2 replies - 1 through 2 (of 2 total)
  • Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Accepted:

    Use the do_action hook in function friends_accept_friendship in this file:
    buddypress\buddypress\bp-friends\bp-friends-functions.php

    function my_accepted_function( $id, $user_id, $friend_id, $friendship  ) {
      // do something
    }
    add_action(''friends_friendship_accepted', 'my_accepted_function', 1, 4 );

    Removed:

    Use one of the 3 do_action hooks in function friends_remove_friend in this file:
    buddypress\buddypress\bp-friends\bp-friends-functions.php

    Which hook you use depends on what you want to do.
    Create a separate function to hook to; something like ‘my_remove_function’.

    Profile photo of CommonEasy
    CommonEasy
    Participant

    @commoneasy

    Hi shanebp,

    Thanks for your reply and help! I got it working! :)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘call function when friendship is accepted or deleted.’ is closed to new replies.