You are here

function invite_stats_user in Invite 5

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

Implementation of hook_user().

File

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

Code

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