I am writing a module that performs a redirect based on what value was in a custom field called "field_account_type" that was added in user settings. How do I store this value in a variable within hook_user_login()?

  • Which hook are you using? Which user object do you need to access? Without those details, the answer can just be as vague as "load the user object, and load the field value using the appropriate field API function."
    – apaderno
    May 6, 2014 at 14:58

1 Answer 1


You can access global $user custom field values in the hook that suits you like this :

function your_hook() {
  global $user;
  $current_user = user_load($user->uid);
  $vars['account_type'] = $current_user->field_account_type[LANGUAGE_NONE][0]['value'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.