You are here

function invite_stats_user in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite_stats.module \invite_stats_user()
  2. 5 invite_stats.module \invite_stats_user()

Implementation of hook_user().

File

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

Code

function invite_stats_user($op, &$edit, &$account, $category = NULL) {
  global $user;
  switch ($op) {
    case 'view':
      $view_access = user_access('view invite statistics');
      $view_own_access = user_access('view own invite statistics') && $account->uid == $user->uid;
      if ($view_access || $view_own_access) {
        $items['accepted'] = array(
          'title' => t('Successful'),
          'value' => invite_count($account->uid, 'accepted'),
          'class' => 'successful',
        );
        $items['pending'] = array(
          'title' => t('Pending'),
          'value' => invite_count($account->uid, 'pending'),
          'class' => 'pending',
        );
        $items['expired'] = array(
          'title' => t('Unsuccessful'),
          'value' => invite_count($account->uid, 'expired'),
          'class' => 'expired',
        );
        return array(
          t('Invitation counts') => $items,
        );
      }
      break;
  }
}