Please clarify where you initiate the object $user in both ways (function.php and header.php).
This is another thread on stack with similar kind of issue, have a look:
Organizing Code in your WordPress Theme’s functions.php File?
Thanks,
Vee
Please clarify where you initiate the object $user in both ways (function.php and header.php).
This is another thread on stack with similar kind of issue, have a look:
Organizing Code in your WordPress Theme’s functions.php File?
Thanks,
Vee