You are here

function domain_user_view in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain.module \domain_user_view()

Implements hook_user_view().

File

./domain.module, line 626
Core module functions for the Domain Access suite.

Code

function domain_user_view($account, $view_mode) {
  domain_user_set($account);

  // Only show on full view.
  if ($view_mode != 'full') {
    return;
  }

  // Only show trusted users.
  // TODO: Make this a new permission.
  if (!user_access('assign domain editors')) {
    return;
  }
  $output = '';
  $account->content['domain'] = array(
    '#type' => 'user_profile_category',
    '#weight' => 10,
    '#title' => t('Domain status'),
  );
  if (empty($account->domain_user)) {
    $output = t('This user is not assigned to a domain.');
  }
  else {
    $items = array();
    foreach (array_filter($account->domain_user) as $id) {
      $domain = domain_lookup($id);
      $items[] = check_plain($domain['sitename']);
    }
    $output = theme('item_list', array(
      'items' => $items,
    ));
  }
  $account->content['domain']['domain_settings'] = array(
    '#type' => 'user_profile_item',
    '#title' => t('Assigned domains'),
    '#markup' => $output,
  );
}