本文整理汇总了PHP中BP_Friends_Friendship::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Friends_Friendship::delete方法的具体用法?PHP BP_Friends_Friendship::delete怎么用?PHP BP_Friends_Friendship::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Friends_Friendship
的用法示例。
在下文中一共展示了BP_Friends_Friendship::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friends_remove_friend
function friends_remove_friend($initiator_userid, $friend_userid)
{
$friendship_id = BP_Friends_Friendship::get_friendship_id($initiator_userid, $friend_userid);
$friendship = new BP_Friends_Friendship($friendship_id);
do_action('friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid);
// Remove the activity stream item for the user who canceled the friendship
friends_delete_activity(array('item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => bp_displayed_user_id()));
do_action('friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid);
if ($friendship->delete()) {
friends_update_friend_totals($initiator_userid, $friend_userid, 'remove');
return true;
}
return false;
}
示例2: friends_remove_friend
/**
* Remove a friendship.
*
* Will also delete the related "friendship_accepted" activity item.
*
* @param int $initiator_userid ID of the friendship initiator.
* @param int $friend_userid ID of the friend user.
* @return bool True on success, false on failure.
*/
function friends_remove_friend($initiator_userid, $friend_userid)
{
$friendship_id = BP_Friends_Friendship::get_friendship_id($initiator_userid, $friend_userid);
$friendship = new BP_Friends_Friendship($friendship_id);
do_action('friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid);
// Remove the activity stream item for the user who canceled the friendship
friends_delete_activity(array('item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => bp_displayed_user_id()));
// This hook is misleadingly named - the friendship is not yet deleted.
// This is your last chance to do something while the friendship exists
do_action('friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid);
if ($friendship->delete()) {
friends_update_friend_totals($initiator_userid, $friend_userid, 'remove');
do_action('friends_friendship_post_delete', $initiator_userid, $friend_userid);
return true;
}
return false;
}
示例3: friends_remove_friend
/**
* Remove a friendship.
*
* Will also delete the related "friendship_accepted" activity item.
*
* @since 1.0.0
*
* @param int $initiator_userid ID of the friendship initiator.
* @param int $friend_userid ID of the friend user.
* @return bool True on success, false on failure.
*/
function friends_remove_friend($initiator_userid, $friend_userid)
{
$friendship_id = BP_Friends_Friendship::get_friendship_id($initiator_userid, $friend_userid);
$friendship = new BP_Friends_Friendship($friendship_id);
/**
* Fires before the deletion of a friendship activity item
* for the user who canceled the friendship.
*
* @since 1.5.0
*
* @param int $friendship_id ID of the friendship object, if any, between a pair of users.
* @param int $initiator_userid ID of the friendship initiator.
* @param int $friend_userid ID of the friend user.
*/
do_action('friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid);
// Remove the activity stream items about the friendship id.
friends_delete_activity(array('item_id' => $friendship_id, 'type' => 'friendship_created', 'user_id' => 0));
/**
* Fires before the friendship connection is removed.
*
* This hook is misleadingly named - the friendship is not yet deleted.
* This is your last chance to do something while the friendship exists.
*
* @since 1.0.0
*
* @param int $friendship_id ID of the friendship object, if any, between a pair of users.
* @param int $initiator_userid ID of the friendship initiator.
* @param int $friend_userid ID of the friend user.
*/
do_action('friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid);
if ($friendship->delete()) {
friends_update_friend_totals($initiator_userid, $friend_userid, 'remove');
/**
* Fires after the friendship connection is removed.
*
* @since 1.8.0
*
* @param int $initiator_userid ID of the friendship initiator.
* @param int $friend_userid ID of the friend user.
*/
do_action('friends_friendship_post_delete', $initiator_userid, $friend_userid);
return true;
}
return false;
}
示例4: friends_remove_friend
function friends_remove_friend($initiator_userid, $friend_userid)
{
global $bp;
/* Check the nonce */
if (!check_admin_referer('friends_remove_friend')) {
return false;
}
$friendship_id = BP_Friends_Friendship::get_friendship_id($initiator_userid, $friend_userid);
$friendship = new BP_Friends_Friendship($friendship_id);
// Remove the activity stream items
friends_delete_activity(array('item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id));
do_action('friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid);
if ($friendship->delete()) {
friends_update_friend_totals($initiator_userid, $friend_userid, 'remove');
return true;
}
return false;
}