? drupal-6.x-dev/sites/default/settings.php
Index: drupal-6.x-dev/includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.394
diff -u -p -r1.394 theme.inc
--- drupal-6.x-dev/includes/theme.inc	11 Nov 2007 22:43:44 -0000	1.394
+++ drupal-6.x-dev/includes/theme.inc	14 Nov 2007 07:50:37 -0000
@@ -1618,22 +1618,33 @@ function theme_blocks($region) {
  *
  * @param $object
  *   The user object to format, usually returned from user_load().
+ * @param $options
+ *   An associative array of additional options, with the following keys:
+ *     'plain' (default FALSE)
+ *       Whether to force the output as plain text format. Useful for
+ *       centralize username style handling.
  * @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) {
+function theme_username($object, $options = array()) {
+  // Merge in defaults.
+  $options += array(
+    'plain' => FALSE,
+  );
 
   if ($object->uid && $object->name) {
+    $name = $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) .'...';
+    if (drupal_strlen($name) > 20) {
+      $name = drupal_substr($name, 0, 15) .'...';
     }
     else {
-      $name = $object->name;
+      $name = $name;
     }
 
-    if (user_access('access user profiles')) {
+    if (user_access('access user profiles') && !$options['plain']) {
       $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
     }
     else {
@@ -1641,15 +1652,17 @@ function theme_username($object) {
     }
   }
   else if ($object->name) {
+    $name = $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('rel' => 'nofollow'));
+    if (!empty($object->homepage) && !$options['plain']) {
+      $output = l($name, $object->homepage, array('rel' => 'nofollow'));
     }
     else {
-      $output = check_plain($object->name);
+      $output = check_plain($name);
     }
 
     $output .= ' ('. t('not verified') .')';
Index: drupal-6.x-dev/modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.291
diff -u -p -r1.291 blog.module
--- drupal-6.x-dev/modules/blog/blog.module	4 Nov 2007 15:45:15 -0000	1.291
+++ drupal-6.x-dev/modules/blog/blog.module	14 Nov 2007 07:50:37 -0000
@@ -107,7 +107,7 @@ function blog_form(&$node) {
 function blog_view($node, $teaser = FALSE, $page = FALSE) {
   if ($page) {
     // Breadcrumb navigation
-    drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("@name's blog", array('@name' => $node->name)), 'blog/'. $node->uid)));
+    drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("@name's blog", array('@name' => theme('username', $node, array('plain' => TRUE)))), 'blog/'. $node->uid)));
   }
   return node_prepare($node, $teaser);
 }
@@ -121,9 +121,9 @@ function blog_link($type, $node = NULL, 
   if ($type == 'node' && $node->type == 'blog') {
     if (arg(0) != 'blog' || arg(1) != $node->uid) {
       $links['blog_usernames_blog'] = array(
-        'title' => t("@username's blog", array('@username' => $node->name)),
+        'title' => t("@username's blog", array('@username' => theme('username', $node, array('plain' => TRUE)))),
         'href' => "blog/$node->uid",
-        'attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => $node->name)))
+        'attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => theme('username', $node, array('plain' => TRUE)))))
       );
     }
   }
Index: drupal-6.x-dev/modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.3
diff -u -p -r1.3 blog.pages.inc
--- drupal-6.x-dev/modules/blog/blog.pages.inc	25 Oct 2007 17:44:38 -0000	1.3
+++ drupal-6.x-dev/modules/blog/blog.pages.inc	14 Nov 2007 07:50:37 -0000
@@ -12,7 +12,7 @@
 function blog_page_user($account) {
   global $user;
 
-  drupal_set_title($title = t("@name's blog", array('@name' => $account->name)));
+  drupal_set_title($title = t("@name's blog", array('@name' => theme('username', $account, array('plain' => TRUE)))));
 
   $items = array();
 
@@ -59,7 +59,7 @@ function blog_page_last() {
  */
 function blog_feed_user($account) {
   $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
-  $channel['title'] = $account->name ."'s blog";
+  $channel['title'] = t("@name's blog", array('@name' => theme('username', $account, array('plain' => TRUE))));
   $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
 
   $items = array();
Index: drupal-6.x-dev/modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.602
diff -u -p -r1.602 comment.module
--- drupal-6.x-dev/modules/comment/comment.module	12 Nov 2007 19:06:32 -0000	1.602
+++ drupal-6.x-dev/modules/comment/comment.module	14 Nov 2007 07:50:37 -0000
@@ -1363,7 +1363,7 @@ function comment_form_add_preview($form,
     }
     if (!empty($account)) {
       $comment->uid = $account->uid;
-      $comment->name = check_plain($account->name);
+      $comment->name = theme('username', $account, array('plain' => TRUE));
     }
     elseif (empty($comment->name)) {
       $comment->name = variable_get('anonymous', t('Anonymous'));
Index: drupal-6.x-dev/modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.4
diff -u -p -r1.4 contact.pages.inc
--- drupal-6.x-dev/modules/contact/contact.pages.inc	2 Oct 2007 16:03:17 -0000	1.4
+++ drupal-6.x-dev/modules/contact/contact.pages.inc	14 Nov 2007 07:50:38 -0000
@@ -42,7 +42,7 @@ function contact_mail_page() {
     $form['name'] = array('#type' => 'textfield',
       '#title' => t('Your name'),
       '#maxlength' => 255,
-      '#default_value' => $user->uid ? $user->name : '',
+      '#default_value' => $user->uid ? theme('username', $user, array('plain' => TRUE)) : '',
       '#required' => TRUE,
     );
     $form['mail'] = array('#type' => 'textfield',
@@ -160,7 +160,7 @@ function contact_user_page($account) {
     $output = t('You cannot contact more than %number users per hour. Please try again later.', array('%number' => variable_get('contact_hourly_threshold', 3)));
   }
   else {
-    drupal_set_title(check_plain($account->name));
+    drupal_set_title(theme('username', $account, array('plain' => TRUE)));
     $output = drupal_get_form('contact_mail_user', $account);
   }
 
@@ -173,11 +173,11 @@ function contact_mail_user(&$form_state,
   $form['recipient'] = array('#type' => 'value', '#value' => $recipient);
   $form['from'] = array('#type' => 'item',
     '#title' => t('From'),
-    '#value' => check_plain($user->name) .' &lt;'. check_plain($user->mail) .'&gt;',
+    '#value' => theme('username', $user, array('plain' => TRUE)) .' &lt;'. check_plain($user->mail) .'&gt;',
   );
   $form['to'] = array('#type' => 'item',
     '#title' => t('To'),
-    '#value' => check_plain($recipient->name),
+    '#value' => theme('username', $recipient, array('plain' => TRUE)),
   );
   $form['subject'] = array('#type' => 'textfield',
     '#title' => t('Subject'),
Index: drupal-6.x-dev/modules/openid/openid.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 openid.pages.inc
--- drupal-6.x-dev/modules/openid/openid.pages.inc	8 Nov 2007 13:58:32 -0000	1.2
+++ drupal-6.x-dev/modules/openid/openid.pages.inc	14 Nov 2007 07:50:38 -0000
@@ -28,7 +28,7 @@ function openid_authentication_page() {
  * Menu callback; Manage OpenID identities for the specified user.
  */
 function openid_user_identities($account) {
-  drupal_set_title(check_plain($account->name));
+  drupal_set_title(theme('username', $account, array('plain' => TRUE)));
   drupal_add_css(drupal_get_path('module', 'openid') .'/openid.css', 'module');
 
   // Check to see if we got a response
Index: drupal-6.x-dev/modules/statistics/statistics.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 statistics.pages.inc
--- drupal-6.x-dev/modules/statistics/statistics.pages.inc	20 Oct 2007 21:57:50 -0000	1.2
+++ drupal-6.x-dev/modules/statistics/statistics.pages.inc	14 Nov 2007 07:50:38 -0000
@@ -60,7 +60,7 @@ function statistics_user_tracker() {
       $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3));
     }
 
-    drupal_set_title(check_plain($account->name));
+    drupal_set_title(theme('username', $account, array('plain' => TRUE)));
     $output = theme('table', $header, $rows);
     $output .= theme('pager', NULL, 30, 0);
     return $output;
Index: drupal-6.x-dev/modules/tracker/tracker.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v
retrieving revision 1.4
diff -u -p -r1.4 tracker.pages.inc
--- drupal-6.x-dev/modules/tracker/tracker.pages.inc	6 Nov 2007 08:51:23 -0000	1.4
+++ drupal-6.x-dev/modules/tracker/tracker.pages.inc	14 Nov 2007 07:50:38 -0000
@@ -19,7 +19,7 @@ function tracker_page($account = NULL, $
       // When viewed from user/%user/track, display the name of the user
       // as page title -- the tab title remains Track so this needs to be done
       // here and not in the menu definiton.
-      drupal_set_title(check_plain($account->name));
+      drupal_set_title(theme('username', $account, array('plain' => TRUE)));
     }
   // TODO: These queries are very expensive, see http://drupal.org/node/105639
     $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
Index: drupal-6.x-dev/modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.862
diff -u -p -r1.862 user.module
--- drupal-6.x-dev/modules/user/user.module	6 Nov 2007 12:20:14 -0000	1.862
+++ drupal-6.x-dev/modules/user/user.module	14 Nov 2007 07:50:38 -0000
@@ -548,13 +548,13 @@ function user_search($op = 'search', $ke
           // Administrators can also search in the otherwise private email field.
           $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys);
           while ($account = db_fetch_object($result)) {
-            $find[] = array('title' => $account->name .' ('. $account->mail .')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
+            $find[] = array('title' => theme('username', $account, array('plain' => TRUE)) .' ('. $account->mail .')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
           }
         }
         else {
           $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
           while ($account = db_fetch_object($result)) {
-            $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
+            $find[] = array('title' => theme('username', $account, array('plain' => TRUE)), 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
           }
         }
         return $find;
@@ -706,7 +706,7 @@ function user_block($op = 'list', $delta
 
       case 1:
         if ($menu = menu_tree()) {
-           $block['subject'] = $user->uid ? check_plain($user->name) : t('Navigation');
+           $block['subject'] = $user->uid ? theme('username', $user, array('plain' => TRUE)) : t('Navigation');
            $block['content'] = $menu;
         }
         return $block;
@@ -2066,7 +2066,7 @@ function user_block_user_action(&$object
   }
   db_query("UPDATE {users} SET status = 0 WHERE uid = %d", $uid);
   sess_destroy_uid($uid);
-  watchdog('action', 'Blocked user %name.', array('%name' => check_plain($user->name)));
+  watchdog('action', 'Blocked user %name.', array('%name' => theme('username', $user, array('plain' => TRUE))));
 }
 
 /**
Index: drupal-6.x-dev/modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.3
diff -u -p -r1.3 user.pages.inc
--- drupal-6.x-dev/modules/user/user.pages.inc	27 Oct 2007 14:01:12 -0000	1.3
+++ drupal-6.x-dev/modules/user/user.pages.inc	14 Nov 2007 07:50:38 -0000
@@ -12,9 +12,9 @@
 function user_autocomplete($string = '') {
   $matches = array();
   if ($string) {
-    $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
+    $result = db_query_range("SELECT uid, name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
     while ($user = db_fetch_object($result)) {
-      $matches[$user->name] = check_plain($user->name);
+      $matches[$user->name] = theme('username', $user, array('plain' => TRUE));
     }
   }
 
@@ -150,7 +150,7 @@ function user_logout() {
  * Menu callback; Displays a user or user profile page.
  */
 function user_view($account) {
-  drupal_set_title(check_plain($account->name));
+  drupal_set_title(theme('username', $account, array('plain' => TRUE)));
   // Retrieve all profile fields and attach to $account->content.
   user_build_content($account);
   /**
@@ -222,7 +222,7 @@ function template_preprocess_user_profil
  * @see user_edit_submit().
  */
 function user_edit($account, $category = 'account') {
-  drupal_set_title(check_plain($account->name));
+  drupal_set_title(theme('username', $account, array('plain' => TRUE)));
   return drupal_get_form('user_profile_form', $account, $category);
 }
 
