You are here

function theme_apachesolr_multisitesearch_username in Apache Solr Multisite Search 6.2

Same name and namespace in other branches
  1. 6 apachesolr_multisitesearch.module \theme_apachesolr_multisitesearch_username()

Modified username theme function.

See also

theme_username()

1 theme call to theme_apachesolr_multisitesearch_username()
apachesolr_multisitesearch_process_response in ./apachesolr_multisitesearch.module

File

./apachesolr_multisitesearch.module, line 433
Provides a multi-site search implementation for use with the Apache Solr module

Code

function theme_apachesolr_multisitesearch_username($doc) {
  if ($doc->name) {

    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($doc->name) > 20) {
      $name = drupal_substr($doc->name, 0, 15) . '...';
    }
    else {
      $name = $doc->name;
    }

    // Only make links for local users.
    if ($doc->uid && apachesolr_site_hash() == $doc->hash && user_access('access user profiles')) {
      $output = l($name, 'user/' . $doc->uid, array(
        'attributes' => array(
          'title' => t('View user profile.'),
        ),
      ));
    }
    else {
      $output = check_plain($name);
    }
  }
  else {
    $output = check_plain(variable_get('anonymous', t('Anonymous')));
  }
  return $output;
}