You are here

function crm_core_user_sync_user_view in CRM Core 7

Same name and namespace in other branches
  1. 8.3 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_user_view()
  2. 8 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_user_view()
  3. 8.2 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_user_view()

Implements hook_user_view().

File

modules/crm_core_user_sync/crm_core_user_sync.module, line 528

Code

function crm_core_user_sync_user_view($account, $view_mode, $langcode) {
  $contact = crm_core_user_sync_get_contact_from_uid($account->uid);
  if ($contact) {
    $content = array(
      '#type' => 'user_profile_item',
      '#title' => t('Contact Information'),
    );
    $contact_label = t('Contact name: ');
    global $user;
    if (user_access('edit any crm_core_contact entity', $user)) {
      $uri = $contact
        ->uri();
      $content['#markup'] = $contact_label . l($contact
        ->label(), $uri['path']);
    }
    else {
      $content['#markup'] = $contact_label . $contact
        ->label();
    }
    $account->content['crm_core'] = $content;
  }
}