You are here

function realname_user in Real Name 5

Same name and namespace in other branches
  1. 6 realname.module \realname_user()

Implementation of hook_user().

File

./realname.module, line 112
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function realname_user($op, &$edit, &$account, $category = NULL) {
  if ($op == 'load') {
    $account->realname = realname_make_name($account);

    // If theme then replace name with realname.
    if (variable_get('realname_theme', TRUE) && $account->realname) {

      //Store it for places where it needed
      if (!isset($account->realname_save) && is_object($account)) {
        $account->realname_save = $account->name;

        //        $account->name = $account->realname;
      }
    }
  }
}