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()?
1 Answer
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'];
}