public function test_get_invites_with_exclude()
 {
     $g1 = $this->factory->group->create(array('name' => 'RC Cola'));
     $g2 = $this->factory->group->create(array('name' => 'Pepsi'));
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     self::add_user_to_group($u1, $g1);
     self::add_user_to_group($u1, $g2);
     self::invite_user_to_group($u2, $g1, $u1);
     self::invite_user_to_group($u2, $g2, $u1);
     $groups = BP_Groups_Member::get_invites($u2, false, false, array('awesome', $g1));
     $ids = wp_list_pluck($groups['groups'], 'id');
     $this->assertEquals($ids, array($g2));
 }
/**
 * Get IDs of users with outstanding invites to a given group from a specified user.
 *
 * @param int               $user_id ID of the inviting user.
 * @param int|bool          $limit Limit to restrict to.
 * @param int|bool          $page
 * @param string|array|bool $exclude
 *
 * @return array $value IDs of users who have been invited to the group by the
 *                      user but have not yet accepted.
 */
function groups_get_invites_for_user($user_id = 0, $limit = false, $page = false, $exclude = false)
{
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    return BP_Groups_Member::get_invites($user_id, $limit, $page, $exclude);
}
function groups_get_invites_for_user($user_id = 0, $limit = false, $page = false, $exclude = false)
{
    global $bp;
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    return BP_Groups_Member::get_invites($user_id, $limit, $page, $exclude);
}
Example #4
0
function groups_get_invites_for_user($user_id = false)
{
    global $bp;
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    return BP_Groups_Member::get_invites($user_id);
}