A Fine Fix for “get_currentuserinfo undefined”
How to Fix the Fatal Error “get_currentuserinfo() undefined” in WordPress
If you write a WordPress plugin that calls the function “get_currentuserinfo()”, you should be aware that this could trigger the fatal error, “get_currentuserinfo undefined’, in some WordPress configurations. Depending on what your plugin does, this error could impact a WordPress site’s display, so it is important to prevent it from ever happening.
One fix (as published by several WP bloggers) is to edit your plugin to add the code, include "/wp-includes/pluggable.php"
A better fix is to include a priority argument with your plugin hook function to make sure that it loads into WordPress after any membership/user management plugins and after “pluggable.php” loads. I found that a priority of “20″ is a high enough number to lower the priority to accomplish this. Ex:
add_action('plugins_loaded', 'load_my_plugin',20);
To use the above example, you should group all your plugin functions and any action or filter functions that contain “get_currentuserinfo()” together into a single hook function, “load_my_plugin()”. Then put “plugins_loaded”, “load_my_plugin” and the priority, “20″, as arguments for an ‘add_action()’ call to tell WordPress to load all plugins with standard (10) or higher priorities before your plugin and load “pluggable.php” module, thus avoiding any conflicts with membership/user-management plugins and “get_currentuserinfo() undefined” fatal errors.

