Ejemplo n.º 1
0
 public function test_groups_is_user_invited_should_return_true_for_invited_member()
 {
     $i = groups_invite_user(array('user_id' => self::$user, 'group_id' => self::$groups[1], 'inviter_id' => 123));
     // Send invite.
     $m = new BP_Groups_Member(self::$user, self::$groups[1]);
     $m->invite_sent = 1;
     $m->save();
     $this->assertNotEmpty(groups_is_user_invited(self::$user, self::$groups[1]));
 }
 /**
  * Fetch extra data for a list of groups.
  *
  * This method is used throughout the class, by methods that take a
  * $populate_extras parameter.
  *
  * Data fetched:
  *     - Logged-in user's status within each group (is_member,
  *       is_confirmed, is_pending, is_banned)
  *
  * @since 1.6.0
  *
  * @param array        $paged_groups Array of groups.
  * @param string|array $group_ids    Array or comma-separated list of IDs matching
  *                                   $paged_groups.
  * @param string|bool  $type         Not used.
  * @return array $paged_groups
  */
 public static function get_group_extras(&$paged_groups, &$group_ids, $type = false)
 {
     $user_id = bp_loggedin_user_id();
     foreach ($paged_groups as &$group) {
         $group->is_member = groups_is_user_member($user_id, $group->id) ? 1 : 0;
         $group->is_invited = groups_is_user_invited($user_id, $group->id) ? 1 : 0;
         $group->is_pending = groups_is_user_pending($user_id, $group->id) ? 1 : 0;
         $group->is_banned = (bool) groups_is_user_banned($user_id, $group->id);
     }
     return $paged_groups;
 }