You are here

function invite_stats_user_view in Invite 7.2

Implements hook_user_view().

File

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

Code

function invite_stats_user_view($account, $view_mode, $langcode) {
  global $user;
  $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) {
    $account->content['invite_stats'] = array(
      '#type' => 'user_profile_category',
      '#title' => t('Invite statistics'),
      '#markup' => '',
    );
    $account->content['invite_stats']['accepted'] = array(
      '#type' => 'user_profile_item',
      '#title' => t('Successful'),
      '#markup' => invite_count($account->uid, 'accepted'),
    );
    $account->content['invite_stats']['pending'] = array(
      '#type' => 'user_profile_item',
      '#title' => t('Pending'),
      '#markup' => invite_count($account->uid, 'pending'),
    );
    $account->content['invite_stats']['expired'] = array(
      '#type' => 'user_profile_item',
      '#title' => t('Unsuccessful'),
      '#markup' => invite_count($account->uid, 'expired'),
    );
  }
}