Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.461 diff -u -F^f -r1.461 common.inc --- includes/common.inc 27 Jul 2005 01:58:43 -0000 1.461 +++ includes/common.inc 29 Jul 2005 11:45:13 -0000 @@ -965,53 +965,6 @@ function format_date($timestamp, $type = } /** - * Format a username. - * - * @param $object - * The user object to format, usually returned from user_load(). - * @return - * A string containing an HTML link to the user's page if the passed object - * suggests that this is a site user. Otherwise, only the username is returned. - */ -function format_name($object) { - - if ($object->uid && $object->name) { - // Shorten the name when it is too long or it will break many tables. - if (strlen($object->name) > 20) { - $name = truncate_utf8($object->name, 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 = $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 = ''. $object->name .''; - } - else { - $output = $object->name; - } - - $output .= ' ('. t('not verified') .')'; - } - else { - $output = variable_get('anonymous', 'Anonymous'); - } - - return $output; -} -/** * @} End of "defgroup format". */ Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.248 diff -u -F^f -r1.248 theme.inc --- includes/theme.inc 29 Jul 2005 07:49:43 -0000 1.248 +++ includes/theme.inc 29 Jul 2005 11:45:13 -0000 @@ -580,10 +580,10 @@ function theme_node($node, $teaser = FAL } if ($page == 0) { - $output = '

'. check_plain($node->title) .'

by '. format_name($node); + $output = '

'. check_plain($node->title) .'

by '. theme('username', $node); } else { - $output = 'by '. format_name($node); + $output = 'by '. theme('username', $node); } if (count($terms)) { @@ -994,6 +994,53 @@ function theme_confirm($question, $path, return form($output, 'post', NULL, array('class' => 'confirmation')); } +/** + * Format a username. + * + * @param $object + * The user object to format, usually returned from user_load(). + * @return + * A string containing an HTML link to the user's page if the passed object + * suggests that this is a site user. Otherwise, only the username is returned. + */ +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 = $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 = ''. $object->name .''; + } + else { + $output = $object->name; + } + + $output .= ' ('. t('not verified') .')'; + } + else { + $output = variable_get('anonymous', 'Anonymous'); + } + + return $output; +} /** * @} End of "defgroup themeable". Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.362 diff -u -F^f -r1.362 comment.module --- modules/comment.module 29 Jul 2005 08:18:19 -0000 1.362 +++ modules/comment.module 29 Jul 2005 11:45:14 -0000 @@ -1020,7 +1020,7 @@ function comment_admin_overview($type = $comment->name = $comment->uid ? $comment->registered_name : $comment->name; $rows[] = array( l($comment->subject, "node/$comment->nid", array('title' => truncate_utf8($comment->comment, 128)), NULL, "comment-$comment->cid") ." ". theme('mark', node_mark($comment->nid, $comment->timestamp)), - format_name($comment), + theme('username', $comment), ($comment->status == COMMENT_PUBLISHED ? t('Published') : t('Not published')), format_date($comment->timestamp, 'small'), l(t('edit'), "comment/edit/$comment->cid", array(), $destination), @@ -1400,7 +1400,7 @@ function theme_comment_form($edit, $titl $form .= "\n"; } else { - $form .= form_item(t('Your name'), format_name($user)); + $form .= form_item(t('Your name'), theme('username', $user)); } } else if (variable_get('comment_anonymous', 0) == 1) { @@ -1554,7 +1554,7 @@ function theme_comment($comment, $links $output = "
\n"; $output .= '
'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") . ' ' . theme('mark', $comment->new) ."
\n"; $output .= '
'. $comment->moderation ."
\n"; - $output .= '
'. t('by %a on %b', array('%a' => format_name($comment), '%b' => format_date($comment->timestamp))) ."
\n"; + $output .= '
'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."
\n"; $output .= "
$comment->comment
\n"; $output .= "
$links
\n"; $output .= "
\n"; @@ -1564,7 +1564,7 @@ function theme_comment($comment, $links function theme_comment_folded($comment) { $output = "
\n"; $output .= ' '. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") . ' '. theme('mark', $comment->new) .' '; - $output .= ''. t('by') .' '. format_name($comment) ."\n"; + $output .= ''. t('by') .' '. theme('username', $comment) ."\n"; $output .= "
\n"; return $output; } Index: modules/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum.module,v retrieving revision 1.259 diff -u -F^f -r1.259 forum.module --- modules/forum.module 18 Jul 2005 19:31:16 -0000 1.259 +++ modules/forum.module 29 Jul 2005 11:45:14 -0000 @@ -581,7 +581,7 @@ function forum_delete(&$node) { */ function _forum_format($topic) { if ($topic && $topic->timestamp) { - return t('%time ago
by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => format_name($topic))); + return t('%time ago
by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => theme('username', $topic))); } else { return message_na(); Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.511 diff -u -F^f -r1.511 node.module --- modules/node.module 29 Jul 2005 03:29:53 -0000 1.511 +++ modules/node.module 29 Jul 2005 11:45:14 -0000 @@ -577,7 +577,7 @@ function node_search($op = 'search', $ke $results[] = array('link' => url('node/'. $item), 'type' => node_invoke($node, 'node_name'), 'title' => $node->title, - 'user' => format_name($node), + 'user' => theme('username', $node), 'date' => $node->changed, 'extra' => $extra, 'snippet' => search_excerpt($keys, $node->body)); @@ -913,7 +913,7 @@ function node_admin_nodes() { $rows[] = array(form_checkbox(NULL, 'nodes]['. $node->nid, 1, 0), l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)), node_invoke($node, 'node_name'), - format_name($node), + theme('username', $node), ($node->status ? t('published') : t('not published')), l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination)); } @@ -979,7 +979,7 @@ function node_revision_overview($nid) { $header = array(t('Older revisions'), array('colspan' => '3', 'data' => t('Operations'))); foreach ($node->revisions as $key => $revision) { - $rows[] = array(t('revision #%r revised by %u on %d', array('%r' => $key, '%u' => format_name(user_load(array('uid' => $revision['uid']))), '%d' => format_date($revision['timestamp'], 'small'))) . ($revision['history'] ? '
'. $revision['history'] .'' : ''), l(t('view'), "node/$node->nid", array(), "revision=$key"), l(t('rollback'), "node/$node->nid/rollback-revision/$key"), l(t('delete'), "node/$node->nid/delete-revision/$key")); + $rows[] = array(t('revision #%r revised by %u on %d', array('%r' => $key, '%u' => theme('username', user_load(array('uid' => $revision['uid']))), '%d' => format_date($revision['timestamp'], 'small'))) . ($revision['history'] ? '
'. $revision['history'] .'' : ''), l(t('view'), "node/$node->nid", array(), "revision=$key"), l(t('rollback'), "node/$node->nid/rollback-revision/$key"), l(t('delete'), "node/$node->nid/delete-revision/$key")); } $output .= theme('table', $header, $rows); } Index: modules/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile.module,v retrieving revision 1.100 diff -u -F^f -r1.100 profile.module --- modules/profile.module 27 Jun 2005 18:33:32 -0000 1.100 +++ modules/profile.module 29 Jul 2005 11:45:14 -0000 @@ -649,7 +649,7 @@ function theme_profile_listing($user, $f $output = "
\n"; $output .= theme('user_picture', $user); - $output .= '
'. format_name($user) ."
\n"; + $output .= '
'. theme('username', $user) ."
\n"; foreach ($fields as $field) { if ($value = profile_view_field($user, $field)) { Index: modules/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics.module,v retrieving revision 1.200 diff -u -F^f -r1.200 statistics.module --- modules/statistics.module 29 Jul 2005 06:59:29 -0000 1.200 +++ modules/statistics.module 29 Jul 2005 11:45:14 -0000 @@ -149,7 +149,7 @@ function statistics_access_log($aid) { $output .= ' '. t('Page title') .''. check_plain($access->title) .''; $output .= ' '. t('Referrer') ."". ($access->url ? l($access->url, $access->url) : '') .""; $output .= ' '. t('Date') .''. format_date($access->timestamp, 'large') .''; - $output .= ' '. t('User') .''. format_name($access) .''; + $output .= ' '. t('User') .''. theme('username', $access) .''; $output .= ' '. t('Hostname') .''. check_plain($access->hostname) .''; $output .= ''; return $output; @@ -173,7 +173,7 @@ function statistics_node_tracker() { $rows[] = array( array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), l(_statistics_column_width($log->url), $log->url), - format_name($log), + theme('username', $log), l(t('details'), "admin/logs/access/$log->aid")); } @@ -235,7 +235,7 @@ function statistics_recent_hits($type = $rows[] = array( array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), _statistics_format_item($log->title, $log->path), - format_name($log), + theme('username', $log), l(t('details'), "admin/logs/access/$log->aid")); } @@ -293,7 +293,7 @@ function statistics_top_visitors() { while ($account = db_fetch_object($result)) { $qs = drupal_get_destination(); $ban_link = $account->aid ? l(t('unban'), "admin/access/rules/delete/$account->aid", array(), $qs) : l(t('ban'), "admin/access/rules/add/$account->hostname/host", array(), $qs); - $rows[] = array($account->hits, ($account->uid ? format_name($account) : $account->hostname), format_interval(round($account->total / 1000)), $ban_link); + $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), $ban_link); } if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) { Index: modules/tracker.module =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker.module,v retrieving revision 1.118 diff -u -F^f -r1.118 tracker.module --- modules/tracker.module 14 May 2005 17:01:31 -0000 1.118 +++ modules/tracker.module 29 Jul 2005 11:45:14 -0000 @@ -102,7 +102,7 @@ function tracker_page($uid = 0) { $rows[] = array( node_invoke($node->type, 'node_name'), l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)), - format_name($node), + theme('username', $node), array('class' => 'replies', 'data' => $comments), t('%time ago', array('%time' => format_interval(time() - $node->last_post))) ); Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.493 diff -u -F^f -r1.493 user.module --- modules/user.module 29 Jul 2005 07:18:36 -0000 1.493 +++ modules/user.module 29 Jul 2005 11:45:14 -0000 @@ -628,7 +628,7 @@ function theme_user_profile($account, $f */ function theme_user_list($users, $title = NULL) { foreach ($users as $user) { - $items[] = format_name($user); + $items[] = theme('username', $user); } return theme('item_list', $items, $title); } @@ -1711,7 +1711,7 @@ function user_admin_account() { $status = array(t('blocked'), t('active')); $destination = drupal_get_destination(); while ($account = db_fetch_object($result)) { - $rows[] = array(format_name($account), + $rows[] = array(theme('username', $account), $status[$account->status], format_interval(time() - $account->created), $account->access ? t('%time ago', array('%time' => format_interval(time() - $account->access))) : t('never'), Index: modules/watchdog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/watchdog.module,v retrieving revision 1.123 diff -u -F^f -r1.123 watchdog.module --- modules/watchdog.module 29 Jul 2005 04:12:19 -0000 1.123 +++ modules/watchdog.module 29 Jul 2005 11:45:14 -0000 @@ -104,7 +104,7 @@ function watchdog_overview() { t($watchdog->type), format_date($watchdog->timestamp, 'small'), truncate_utf8($watchdog->message, 64), - format_name($watchdog), + theme('username', $watchdog), $watchdog->link, l(t('details'), "admin/logs/event/$watchdog->wid") ), @@ -139,7 +139,7 @@ function watchdog_event($id) { $output .= ''; $output .= ' '; $output .= ' '; - $output .= ' '; + $output .= ' '; $output .= ' "; $output .= ' "; $output .= ' "; Index: themes/chameleon/chameleon.theme =================================================================== RCS file: /cvs/drupal/drupal/themes/chameleon/chameleon.theme,v retrieving revision 1.30 diff -u -F^f -r1.30 chameleon.theme --- themes/chameleon/chameleon.theme 6 Jun 2005 14:07:04 -0000 1.30 +++ themes/chameleon/chameleon.theme 29 Jul 2005 11:45:14 -0000 @@ -126,7 +126,7 @@ function chameleon_node($node, $main = 0 $output .= " \n"; - $submitted = theme_get_setting("toggle_node_info_$node->type") ? array(t("By %author at %date", array('%author' => format_name($node), '%date' => format_date($node->created, 'small')))) : array(); + $submitted = theme_get_setting("toggle_node_info_$node->type") ? array(t("By %author at %date", array('%author' => theme('username', $node), '%date' => format_date($node->created, 'small')))) : array(); $terms = array(); if (module_exist('taxonomy')) { @@ -147,7 +147,7 @@ function chameleon_node($node, $main = 0 } function chameleon_comment($comment, $link = "") { - $submitted = array(t('By %author at %date', array('%author' => format_name($comment), '%date' => format_date($comment->timestamp. 'small')))); + $submitted = array(t('By %author at %date', array('%author' => theme('username', $comment), '%date' => format_date($comment->timestamp. 'small')))); $links = array($link); $output = "
\n"; Index: themes/engines/phptemplate/phptemplate.engine =================================================================== RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v retrieving revision 1.8 diff -u -F^f -r1.8 phptemplate.engine --- themes/engines/phptemplate/phptemplate.engine 25 Jul 2005 06:59:37 -0000 1.8 +++ themes/engines/phptemplate/phptemplate.engine 29 Jul 2005 11:45:15 -0000 @@ -205,7 +205,7 @@ function phptemplate_node($node, $main = 'title' => check_plain($node->title), 'node_url' => url('node/'. $node->nid), 'terms' => theme('links', $taxonomy), - 'name' => format_name($node), + 'name' => theme('username', $node), 'date' => format_date($node->created), 'content' => ($main && $node->teaser) ? $node->teaser : $node->body, 'links' => $node->links ? theme('links', $node->links) : '', @@ -220,7 +220,7 @@ function phptemplate_node($node, $main = // Display info only on certain node types. if (theme_get_setting('toggle_node_info_' . $node->type)) { - $variables['submitted'] = t('Submitted by %a on %b.', array('%a' => format_name($node), '%b' => format_date($node->created))); + $variables['submitted'] = t('Submitted by %a on %b.', array('%a' => theme('username', $node), '%b' => format_date($node->created))); $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : ''; } @@ -236,14 +236,14 @@ function phptemplate_comment($comment, $ 'new' => $comment->new ? t('new') : '', 'comment' => $comment, 'submitted' => t('Submitted by %a on %b.', - array('%a' => format_name($comment), + array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))), 'title' => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid"), 'picture' => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '', 'links' => $links, 'content' => $comment->comment, - 'author' => format_name($comment), + 'author' => theme('username', $comment), 'date' => format_date($comment->timestamp) )); }
'. t('Type') .'' . t($watchdog->type) . '
'. t('Date') .''. format_date($watchdog->timestamp, 'large') .'
'. t('User') .''. format_name($watchdog) .'
'. t('User') .''. theme('username', $watchdog) .'
'. t('Location') ."". l($watchdog->location, $watchdog->location) ."
'. t('Referrer') ."". l($watchdog->referer, $watchdog->referer) ."
'. t('Message') ."$watchdog->message