/** * Stop following a user's activity. * * @since 1.0.0 * * @param array $args { * Array of arguments. * @type int $leader_id The user ID of the person we want to stop following. * @type int $follower_id The user ID initiating the unfollow request. * } * @return bool */ function bp_follow_stop_following($args = '') { $r = wp_parse_args($args, array('leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id())); $follow = new BP_Follow($r['leader_id'], $r['follower_id']); if (!$follow->delete()) { return false; } do_action_ref_array('bp_follow_stop_following', array(&$follow)); return true; }
/** * Stop following an item. * * @since 1.0.0 * * @param array $args { * Array of arguments. * @type int $leader_id The object ID we want to stop following. Defaults to the displayed user ID. * @type int $follower_id The object ID stopping the request. Defaults to the logged-in user ID. * @type string $follow_type The follow type. Leave blank for users. Default: '' * } * @return bool */ function bp_follow_stop_following($args = '') { $r = wp_parse_args($args, array('leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id(), 'follow_type' => '')); $follow = new BP_Follow($r['leader_id'], $r['follower_id'], $r['follow_type']); if (empty($follow->id) || !$follow->delete()) { return false; } if (empty($r['follow_type'])) { do_action_ref_array('bp_follow_stop_following', array(&$follow)); } else { do_action_ref_array('bp_follow_stop_following_' . $r['follow_type'], array(&$follow)); } return true; }