I am using below code to get the user login gender information & store in SESSION, I want to call below code after login, I already try this hook function bartik_user_login(&$edit, $account) {}
but its not working. Please help. Thanks
if (user_is_logged_in())
{
global $user;
$uid = user_load($user->uid);
$profile_main = profile2_load_by_user($uid, 'main');
$field_iam = field_get_items('profile2',$profile_main,'field_i_am_field');
$_SESSION['i_am']=$field_iam[0][value];
echo $_SESSION['i_am'];
}