function format_username

cis7 common.inc format_username($account)
cle7 common.inc format_username($account)
elmsmedia7 common.inc format_username($account)
icor7 common.inc format_username($account)
meedjum_blog7 common.inc format_username($account)
mooc7 common.inc format_username($account)

Format a username.

This is also the label callback implementation of callback_entity_info_label() for user_entity_info().

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).

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.

See also

hook_username_alter()

Related topics

39 calls to format_username()
admin_menu_links_account in sites/all/modules/ulmus/admin_menu/admin_menu.inc
Builds the account links.
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().

... See full list

5 string references to 'format_username'
user_entity_info in modules/user/user.module
Implements hook_entity_info().
views_handler_field_user_name::init in sites/all/modules/ulmus/views/modules/user/views_handler_field_user_name.inc
Add uid in the query so we can test for anonymous if needed.
views_handler_field_user_name::options_form in sites/all/modules/ulmus/views/modules/user/views_handler_field_user_name.inc
Provide link to node option
views_handler_field_user_name::option_definition in sites/all/modules/ulmus/views/modules/user/views_handler_field_user_name.inc
Information about options for all kinds of purposes will be held here. @code 'option_name' => array(
views_handler_field_user_name::render_link in sites/all/modules/ulmus/views/modules/user/views_handler_field_user_name.inc

File

includes/common.inc, line 2106
Common functions that many Drupal modules will need to reference.

Code

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