You are here

function invite_count in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_count()
  2. 7.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 in ./invite_stats.module
Implementation of hook_user().

File

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

Code

function invite_count($uid, $op) {
  switch ($op) {
    case 'accepted':
      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined <> 0", $uid));
    case 'pending':
      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND expiry >= %d", $uid, time()));
    case 'expired':
      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND expiry < %d", $uid, time()));
  }
}