format_username

Versions
mediamosa-21
format_username($account)

Format a username.

By default, the passed in object's 'name' property is used if it exists, or else, the site-defined value for the 'anonymous' variable. However, a module may override this by implementing hook_username_alter(&$name, $account).

See also

hook_username_alter()

Parameters

$account The account object for the user whose name is to be formatted.

Return value

An unsanitized string with the username to display. The code receiving this result must ensure that check_plain() is called on it before it is printed to the page.

Related topics

▾ 20 functions call format_username()

blog_feed_user in modules/blog/blog.pages.inc
Menu callback; displays an RSS feed containing recent blog entries of a given user.
blog_node_view in modules/blog/blog.module
Implements hook_node_view().
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
blog_user_view in modules/blog/blog.module
Implements hook_user_view().
blog_view in modules/blog/blog.module
Implements hook_view().
contact_mail in modules/contact/contact.module
Implements hook_mail().
contact_personal_form in modules/contact/contact.pages.inc
Form builder; the personal contact form.
contact_site_form in modules/contact/contact.pages.inc
Form builder; the site-wide contact form.
hook_mail in modules/system/system.api.php
Prepare a message based on parameters; called from drupal_mail().
hook_user_view in modules/user/user.api.php
The user's account information is being displayed.
openid_user_identities in modules/openid/openid.pages.inc
Menu callback; Manage OpenID identities for the specified user.
profile_block_view in modules/profile/profile.module
Implements hook_block_view().
statistics_user_tracker in modules/statistics/statistics.pages.inc
template_preprocess_username in includes/theme.inc
Preprocess variables for theme_username().
template_preprocess_user_picture in modules/user/user.module
Process variables for user-picture.tpl.php.
toolbar_view in modules/toolbar/toolbar.module
Build the admin menu as a structured array ready for drupal_render().
tracker_page in modules/tracker/tracker.pages.inc
Menu callback; prints a listing of active nodes on the site.
user_page_title in modules/user/user.module
Menu item title callback - use the user name.
user_tokens in modules/user/user.tokens.inc
Implements hook_tokens().
_php_filter_tips in modules/php/php.module
Tips callback for php filter.

Code

includes/common.inc, line 1894

<?php
function format_username($account) {
  $name = !empty($account->name) ? $account->name : variable_get('anonymous', t('Anonymous'));
  drupal_alter('username', $name, $account);
  return $name;
}
?>