WordPress $current_user Global Changed in WordPress 3.3

WordPress has been slowly changing their global $current_user object and the changes in WordPress 3.3 broke my Simplr Registration Form Plus plugin and probably a few others. For any other developers trying to investigate why usermeta field values disappear it is because:

global $current_user;

This was used to return an object containing not only the primary user fields but all the meta fields as well. So if you set a user meta field called “age” you could simply do:

global $current_user;
if($current_user->data->age > 21) {
  // the do some adult stuff;

But this shortcut is no longer available to developers and for good reason. As a general rule code should be efficient, meaning it does only what it has to. To load even the most superflous meta fields every time you access the basic user object is a waste of resources.

So good for WordPress, they are improving. But there are likely others like me who figured if WordPress was going to give me the info, then I was going to use it. And like me they’ll have to spend all day tracking down everywhere they used this shortcut and fixing it. Ugh.

Popup Domination Plugin Breaks WordPress 3.3

I’m not the first to be frustrated by the Popup Domination Plugin busting the WordPress admin after upgrading to 3.3. The reason for the break is pretty simple. The plugin uses a WordPress function that itself relies on a function that has yet to be bootstrapped at the point at which the plugin is loaded. The solution is easy thanks to this post. Once you apply the fix you’ll see that Popup Domination has an update. Just auto-upgrade to the new version and you’ll be fine.