global $current_user; get_currentuserinfo() – call on every page?
-
I display and use the user’s information in several locations. I use it to display level-specific and user-specific content, auto-populate fields, etc.
From my understanding, you need to call the following in order to populate the user’s variables:
<?php global $current_user; get_currentuserinfo(); ?>
I thought I could have inserted that call into the theme’s functions file and always have those variables ready, but they return empty if I do that. Is there a way I can call this once and always have the variables ready for use, or do I need to call it on every page where they will be needed?
(And yes, I know I can call specific variables but I’m still in the early development stage. I’ll tweak it later to only pull what I need)
[EDIT] It should be fairly obvious that I’m inexperienced in PHP. While I can read and interpret it just fine, I’m having a hard time figuring it all out from there. If I called something by its wrong name, please feel free to correct me so that I can do better next time.
- The topic ‘global $current_user; get_currentuserinfo() – call on every page?’ is closed to new replies.