theme_username

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

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

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

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

Параметры

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

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

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

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

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

chameleon_comment in themes/chameleon/chameleon.theme
chameleon_node in themes/chameleon/chameleon.theme
comment_admin_overview in modules/comment/comment.module
Конструктор формы; генерирует форму с кратким содержанием комментариев для администратора.
comment_form in modules/comment/comment.module
hook_search in developer/hooks/core.php
Определяет пользовательскую функцию поиска.
node_admin_nodes in modules/node/node.module
node_revision_overview in modules/node/node.module
Generate an overview table of older revisions of a node.
node_search in modules/node/node.module
Implementation of hook_search().
phptemplate_comment in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_comment function to be passed into a pluggable template engine.
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_node function to be passed into a pluggable template engine.
poll_votes in modules/poll/poll.module
Callback for the 'votes' tab for polls you can see other votes on
statistics_access_log in modules/statistics/statistics.module
statistics_node_tracker in modules/statistics/statistics.module
statistics_recent_hits in modules/statistics/statistics.module
Menu callback; presents the 'recent hits' page.
statistics_top_visitors in modules/statistics/statistics.module
Menu callback; presents the 'top visitors' page.
theme_comment in modules/comment/comment.module
theme_comment_folded in modules/comment/comment.module
theme_node in includes/theme.inc
Возвращает темизированную ноду.
theme_profile_listing in modules/profile/profile.module
theme_user_list in modules/user/user.module
Темизирует список пользователей.
tracker_page in modules/tracker/tracker.module
Menu callback. Prints a listing of active nodes on the site.
user_admin_account in modules/user/user.module
watchdog_event in modules/watchdog/watchdog.module
Menu callback; displays details about a log message.
watchdog_overview in modules/watchdog/watchdog.module
Menu callback; displays a listing of log messages.
_forum_format in modules/forum/forum.module
Formats a topic for display

Код

<?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('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 ($object->homepage) {
      $output = l($object->name, $object->homepage);
    }
    else {
      $output = check_plain($object->name);
    }

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

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

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