theme_username

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/theme.inc, строка 1601

Версии
5 – 6
theme_username($object)

Форматирует имя пользователя.

Параметры

$object Объект пользователя, имя которого надо форматировать (обычно возвращаемый функцией user_load()).

Возвращаемое значение

HTML код ссылки, ведущей на страницу пользователя, если он зарегистрирован на сайте. Если нет, возвращается только имя пользователя (например, для анонимных комментаторов).

Связанные темы

▾ 29 функции вызывают theme_username()

blog_page_user in modules/blog/blog.pages.inc
Коллбэк меню. Показывает страницу Друпал с последними записями в блоге данного пользователя.
chameleon_comment in themes/chameleon/chameleon.theme
chameleon_node in themes/chameleon/chameleon.theme
comment_admin_overview in modules/comment/comment.admin.inc
Конструктор формы; генерирует форму с кратким содержанием комментариев для администратора.
comment_form in modules/comment/comment.module
Создаёт базовую форму для комментирования, которая будет добавлена к странице с нодой или отображена на отдельной странице.
contact_mail_user in modules/contact/contact.pages.inc
dblog_event in modules/dblog/dblog.admin.inc
Коллбэк меню; отображает подробности записи журнала системы.
dblog_overview in modules/dblog/dblog.admin.inc
Коллбэк меню; выводит логи сообщений.
hook_search in developer/hooks/core.php
Определяет пользовательскую функцию поиска.
node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_revision_overview in modules/node/node.pages.inc
Generate an overview table of older revisions of a node.
node_search in modules/node/node.module
Реализация hook_search().
phptemplate_comment_submitted in themes/garland/template.php
phptemplate_node_submitted in themes/garland/template.php
poll_votes in modules/poll/poll.pages.inc
Callback for the 'votes' tab for polls you can see other votes on
statistics_access_log in modules/statistics/statistics.admin.inc
Menu callback; Displays recent page accesses.
statistics_node_tracker in modules/statistics/statistics.pages.inc
statistics_recent_hits in modules/statistics/statistics.admin.inc
Menu callback; presents the 'recent hits' page.
statistics_top_visitors in modules/statistics/statistics.admin.inc
Menu callback; presents the 'top visitors' page.
template_preprocess_comment in modules/comment/comment.module
Process variables for comment.tpl.php. See alsocomment.tpl.php
template_preprocess_comment_folded in modules/comment/comment.module
Process variables for comment-folded.tpl.php. See alsocomment-folded.tpl.php
template_preprocess_forum_submitted in modules/forum/forum.module
Process variables to format submission info for display in the forum list and topic list.
template_preprocess_node in includes/theme.inc
Обрабатывает переменные для node.tpl.php
template_preprocess_profile_listing in modules/profile/profile.module
Process variables for profile-listing.tpl.php.
theme_comment_submitted in modules/comment/comment.module
Темизирует информацию об авторстве комментария.
theme_node_submitted in modules/node/node.module
Формат представления "Опубликовано _пользователем_ в _дата/время_" для каждой ноды
theme_user_list in modules/user/user.module
Темизирует список пользователей.
tracker_page in modules/tracker/tracker.pages.inc
Menu callback. Prints a listing of active nodes on the site.
user_admin_account in modules/user/user.admin.inc
Form builder; User administration page. See alsouser_admin_account_validate()

Код

<?php
function theme_username($object) {

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

    if (user_access('access user profiles')) {
      $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
    }
    else {
      $output = check_plain($name);
    }
  }
  else if ($object->name) {
    // Sometimes modules display content composed by people who are
    // not registered members of the site (e.g. mailing list or news
    // aggregator modules). This clause enables modules to display
    // the true author of the content.
    if (!empty($object->homepage)) {
      $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
    }
    else {
      $output = check_plain($object->name);
    }

    $output .= ' ('. t('not verified') .')';
  }
  else {
    $output = check_plain(variable_get('anonymous', t('Anonymous')));
  }

  return $output;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему