You are here

function invite_count in Invite 7.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_count()
  2. 6.2 invite.module \invite_count()

Return count of successful, pending, or unsuccessful invitations.

Parameters

$uid: The user id to calculate count for.

$op: The type of count to calculate: accepted, pending or expired.

Return value

A count.

2 calls to invite_count()
invite_admin_overview in ./invite.admin.inc
Return a list of all users that have invited someone.
invite_stats_user_view in modules/invite_stats/invite_stats.module
Implements hook_user_view().

File

./invite.module, line 1556
Allows your users to send and track invitations to join your site.

Code

function invite_count($uid, $op) {
  switch ($op) {
    case 'accepted':
      return db_query("SELECT COUNT(*) FROM {invite} WHERE uid = :uid AND joined <> 0", array(
        ':uid' => $uid,
      ))
        ->fetchField();
    case 'pending':
      return db_query("SELECT COUNT(*) FROM {invite} WHERE uid = :uid AND joined = 0 AND expiry >= :rtime", array(
        ':uid' => $uid,
        ':rtime' => REQUEST_TIME,
      ))
        ->fetchField();
    case 'expired':
      return db_query("SELECT COUNT(*) FROM {invite} WHERE uid = :uid AND joined = 0 AND expiry < :rtime", array(
        ':uid' => $uid,
        ':rtime' => REQUEST_TIME,
      ))
        ->fetchField();
  }
}