You are here

function userpoints_user in User Points 5

Same name and namespace in other branches
  1. 5.3 userpoints.module \userpoints_user()
  2. 5.2 userpoints.module \userpoints_user()
  3. 6 userpoints.module \userpoints_user()

File

./userpoints.module, line 360

Code

function userpoints_user($op, &$edit, &$account, $category = '') {
  switch ($op) {
    case 'delete':

      // The user is being deleted, delete all traces in userpoints and txn tables
      db_query('DELETE FROM {userpoints} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {userpoints_txn} WHERE uid = %d', $account->uid);
      break;
    case 'view':

      // Get the points for the user
      $points = userpoints_get_current_points($account->uid);
      if (user_access(USERPOINTS_PERM_ADMIN)) {
        $points = l($points, 'admin/user/userpoints/add/' . $account->uid, array(
          'title' => t('Manage points'),
        ));
      }
      $disp_points[] = array(
        'title' => t('User !points', userpoints_translation()),
        'value' => $points,
      );
      return array(
        t('!Points', userpoints_translation()) => $disp_points,
      );
      break;
  }
}