summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-01 05:14:05 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-01 05:14:05 +0000
commit7625a4e91ab81b52f5cd74cabe5b0e0324ef8bb4 (patch)
tree255aa1aab3de018eeb60d5756522e7726c7dbe10
parent22479d876173f5e1704cbafabba667450ecf2512 (diff)
downloadbrdo-7625a4e91ab81b52f5cd74cabe5b0e0324ef8bb4.tar.gz
brdo-7625a4e91ab81b52f5cd74cabe5b0e0324ef8bb4.tar.bz2
- Patch #27737 by Gerhard: format_name($object) -> theme('username', $object).
Usernames can now be themed; eg. an icon/avatar could be added. TODO: update contributed modules + update the migration docs.
-rw-r--r--includes/common.inc47
-rw-r--r--includes/theme.inc51
-rw-r--r--modules/comment.module8
-rw-r--r--modules/comment/comment.module8
-rw-r--r--modules/forum.module2
-rw-r--r--modules/forum/forum.module2
-rw-r--r--modules/node.module6
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/profile.module2
-rw-r--r--modules/profile/profile.module2
-rw-r--r--modules/statistics.module8
-rw-r--r--modules/statistics/statistics.module8
-rw-r--r--modules/tracker.module2
-rw-r--r--modules/tracker/tracker.module2
-rw-r--r--modules/user.module4
-rw-r--r--modules/user/user.module4
-rw-r--r--modules/watchdog.module4
-rw-r--r--modules/watchdog/watchdog.module4
-rw-r--r--themes/chameleon/chameleon.theme4
-rw-r--r--themes/engines/phptemplate/phptemplate.engine8
20 files changed, 91 insertions, 91 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 8a85e0d71..684112c61 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -965,53 +965,6 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
}
/**
- * 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 = '<a href="'. $object->homepage .'">'. $object->name .'</a>';
- }
- else {
- $output = $object->name;
- }
-
- $output .= ' ('. t('not verified') .')';
- }
- else {
- $output = variable_get('anonymous', 'Anonymous');
- }
-
- return $output;
-}
-/**
* @} End of "defgroup format".
*/
diff --git a/includes/theme.inc b/includes/theme.inc
index da3e846a7..501d80715 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -580,10 +580,10 @@ function theme_node($node, $teaser = FALSE, $page = FALSE) {
}
if ($page == 0) {
- $output = '<h2 class="title">'. check_plain($node->title) .'</h2> by '. format_name($node);
+ $output = '<h2 class="title">'. check_plain($node->title) .'</h2> 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, $description = NULL, $yes = NULL, $no =
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 = '<a href="'. $object->homepage .'">'. $object->name .'</a>';
+ }
+ else {
+ $output = $object->name;
+ }
+
+ $output .= ' ('. t('not verified') .')';
+ }
+ else {
+ $output = variable_get('anonymous', 'Anonymous');
+ }
+
+ return $output;
+}
/**
* @} End of "defgroup themeable".
diff --git a/modules/comment.module b/modules/comment.module
index 568471b97..0f66a630a 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1020,7 +1020,7 @@ function comment_admin_overview($type = 'new') {
$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, $title = NULL) {
$form .= "</div>\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 = 0) {
$output = "<div class=\"comment\">\n";
$output .= '<div class="subject">'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") . ' ' . theme('mark', $comment->new) ."</div>\n";
$output .= '<div class="moderation">'. $comment->moderation ."</div>\n";
- $output .= '<div class="credit">'. t('by %a on %b', array('%a' => format_name($comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
+ $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
$output .= "<div class=\"body\">$comment->comment</div>\n";
$output .= "<div class=\"links\">$links</div>\n";
$output .= "</div>\n";
@@ -1564,7 +1564,7 @@ function theme_comment($comment, $links = 0) {
function theme_comment_folded($comment) {
$output = "<div class=\"comment-folded\">\n";
$output .= ' <span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") . ' '. theme('mark', $comment->new) .'</span> ';
- $output .= '<span class="credit">'. t('by') .' '. format_name($comment) ."</span>\n";
+ $output .= '<span class="credit">'. t('by') .' '. theme('username', $comment) ."</span>\n";
$output .= "</div>\n";
return $output;
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 568471b97..0f66a630a 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1020,7 +1020,7 @@ function comment_admin_overview($type = 'new') {
$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, $title = NULL) {
$form .= "</div>\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 = 0) {
$output = "<div class=\"comment\">\n";
$output .= '<div class="subject">'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") . ' ' . theme('mark', $comment->new) ."</div>\n";
$output .= '<div class="moderation">'. $comment->moderation ."</div>\n";
- $output .= '<div class="credit">'. t('by %a on %b', array('%a' => format_name($comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
+ $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
$output .= "<div class=\"body\">$comment->comment</div>\n";
$output .= "<div class=\"links\">$links</div>\n";
$output .= "</div>\n";
@@ -1564,7 +1564,7 @@ function theme_comment($comment, $links = 0) {
function theme_comment_folded($comment) {
$output = "<div class=\"comment-folded\">\n";
$output .= ' <span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") . ' '. theme('mark', $comment->new) .'</span> ';
- $output .= '<span class="credit">'. t('by') .' '. format_name($comment) ."</span>\n";
+ $output .= '<span class="credit">'. t('by') .' '. theme('username', $comment) ."</span>\n";
$output .= "</div>\n";
return $output;
}
diff --git a/modules/forum.module b/modules/forum.module
index 223d6f387..301a3f296 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -581,7 +581,7 @@ function forum_delete(&$node) {
*/
function _forum_format($topic) {
if ($topic && $topic->timestamp) {
- return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => format_name($topic)));
+ return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => theme('username', $topic)));
}
else {
return message_na();
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 223d6f387..301a3f296 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -581,7 +581,7 @@ function forum_delete(&$node) {
*/
function _forum_format($topic) {
if ($topic && $topic->timestamp) {
- return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => format_name($topic)));
+ return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => theme('username', $topic)));
}
else {
return message_na();
diff --git a/modules/node.module b/modules/node.module
index 008bb5a29..efb7ab421 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -577,7 +577,7 @@ function node_search($op = 'search', $keys = null) {
$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'] ? '<br /><small>'. $revision['history'] .'</small>' : ''), 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'] ? '<br /><small>'. $revision['history'] .'</small>' : ''), 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);
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 008bb5a29..efb7ab421 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -577,7 +577,7 @@ function node_search($op = 'search', $keys = null) {
$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'] ? '<br /><small>'. $revision['history'] .'</small>' : ''), 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'] ? '<br /><small>'. $revision['history'] .'</small>' : ''), 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);
}
diff --git a/modules/profile.module b/modules/profile.module
index a62c23385..939e47f7e 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -649,7 +649,7 @@ function theme_profile_listing($user, $fields = array()) {
$output = "<div class=\"profile\">\n";
$output .= theme('user_picture', $user);
- $output .= ' <div class="name">'. format_name($user) ."</div>\n";
+ $output .= ' <div class="name">'. theme('username', $user) ."</div>\n";
foreach ($fields as $field) {
if ($value = profile_view_field($user, $field)) {
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index a62c23385..939e47f7e 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -649,7 +649,7 @@ function theme_profile_listing($user, $fields = array()) {
$output = "<div class=\"profile\">\n";
$output .= theme('user_picture', $user);
- $output .= ' <div class="name">'. format_name($user) ."</div>\n";
+ $output .= ' <div class="name">'. theme('username', $user) ."</div>\n";
foreach ($fields as $field) {
if ($value = profile_view_field($user, $field)) {
diff --git a/modules/statistics.module b/modules/statistics.module
index 4f10af1c9..4c9f40762 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -149,7 +149,7 @@ function statistics_access_log($aid) {
$output .= ' <tr><th>'. t('Page title') .'</th><td>'. check_plain($access->title) .'</td></tr>';
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". ($access->url ? l($access->url, $access->url) : '') ."</td></tr>";
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($access->timestamp, 'large') .'</td></tr>';
- $output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($access) .'</td></tr>';
+ $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $access) .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') .'</th><td>'. check_plain($access->hostname) .'</td></tr>';
$output .= '</table>';
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 = 'all', $id = 0) {
$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())) {
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 4f10af1c9..4c9f40762 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -149,7 +149,7 @@ function statistics_access_log($aid) {
$output .= ' <tr><th>'. t('Page title') .'</th><td>'. check_plain($access->title) .'</td></tr>';
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". ($access->url ? l($access->url, $access->url) : '') ."</td></tr>";
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($access->timestamp, 'large') .'</td></tr>';
- $output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($access) .'</td></tr>';
+ $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $access) .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') .'</th><td>'. check_plain($access->hostname) .'</td></tr>';
$output .= '</table>';
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 = 'all', $id = 0) {
$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())) {
diff --git a/modules/tracker.module b/modules/tracker.module
index 15c32e500..6dd4ace45 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -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)))
);
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 15c32e500..6dd4ace45 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -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)))
);
diff --git a/modules/user.module b/modules/user.module
index 242dcb4b4..6fba6771d 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -639,7 +639,7 @@ function theme_user_profile($account, $fields) {
*/
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);
}
@@ -1722,7 +1722,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'),
diff --git a/modules/user/user.module b/modules/user/user.module
index 242dcb4b4..6fba6771d 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -639,7 +639,7 @@ function theme_user_profile($account, $fields) {
*/
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);
}
@@ -1722,7 +1722,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'),
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 68f460c35..4793132b9 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -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 .= '<table border="1" cellpadding="2" cellspacing="2">';
$output .= ' <tr><th>'. t('Type') .'</th><td>' . t($watchdog->type) . '</td></tr>';
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($watchdog->timestamp, 'large') .'</td></tr>';
- $output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
+ $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". l($watchdog->referer, $watchdog->referer) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 68f460c35..4793132b9 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -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 .= '<table border="1" cellpadding="2" cellspacing="2">';
$output .= ' <tr><th>'. t('Type') .'</th><td>' . t($watchdog->type) . '</td></tr>';
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($watchdog->timestamp, 'large') .'</td></tr>';
- $output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
+ $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". l($watchdog->referer, $watchdog->referer) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
index 869618fe0..26b380ca4 100644
--- a/themes/chameleon/chameleon.theme
+++ b/themes/chameleon/chameleon.theme
@@ -126,7 +126,7 @@ function chameleon_node($node, $main = 0, $page = 0) {
$output .= " </div>\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, $page = 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 = "<div class=\"comment\">\n";
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index 22b1d9805..57c203a29 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -206,7 +206,7 @@ function phptemplate_node($node, $main = 0, $page = 0) {
'date' => format_date($node->created),
'links' => $node->links ? theme('links', $node->links) : '',
'main' => $main,
- 'name' => format_name($node),
+ 'name' => theme('username', $node),
'node' => $node, // we pass the actual node to allow more customization
'node_url' => url('node/'. $node->nid),
'page' => $page,
@@ -220,7 +220,7 @@ function phptemplate_node($node, $main = 0, $page = 0) {
// 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) : '';
}
@@ -233,7 +233,7 @@ function phptemplate_node($node, $main = 0, $page = 0) {
*/
function phptemplate_comment($comment, $links = 0) {
return _phptemplate_callback('comment', array(
- 'author' => format_name($comment),
+ 'author' => theme('username', $comment),
'comment' => $comment,
'content' => $comment->comment,
'date' => format_date($comment->timestamp),
@@ -241,7 +241,7 @@ function phptemplate_comment($comment, $links = 0) {
'new' => $comment->new ? t('new') : '',
'picture' => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $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")
));