You are here

function invite_stats in Invite 5

Return counts of successful/pending/unsuccessful invitations.

Parameters

$uid: The user id to calculate counts for.

Return value

An array consisting of three elements: accepted, pending and expired.

1 call to invite_stats()
invite_stats_user in ./invite_stats.module
Implementation of hook_user().

File

./invite_stats.module, line 108
Displays some statistics about sent invitations.

Code

function invite_stats($uid) {
  $time = time();
  $count['accepted'] = db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND timestamp > 0", $uid));
  $count['pending'] = db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND timestamp = 0 AND expiry >= %d", $uid, $time));
  $count['expired'] = db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND timestamp = 0 AND expiry < %d", $uid, $time));
  return $count;
}