You are here

function name_username_alter_preload in Name Field 7

Internal helper function to load the user account if required.

Recursion check in place after RealName module issue queue suggested that there were issues with token based recursion on load.

2 calls to name_username_alter_preload()
name_username_alter in ./name.module
Implements hook_username_alter().
_webform_render_name in includes/webform.components.inc
Implements Webform callback _webform_render_COMPONENT().

File

./name.module, line 256
Defines an API for displaying and inputing names.

Code

function name_username_alter_preload(&$account) {
  static $in_preload = FALSE;
  if (!$in_preload && !isset($account->realname)) {
    $field_name = variable_get('name_user_preferred', FALSE);
    if ($field_name && ($instance = field_info_instance('user', $field_name, 'user'))) {
      $in_preload = TRUE;
      $account = user_load($account->uid);
      $in_preload = FALSE;
    }
  }
}