Discussion:
http://wordpress.org/plugins/plugin-organizer/ Breaks 3.7
Glenn Tate
2013-10-25 22:38:53 UTC
Permalink
White screens and throws this error:

Call to undefined function wp_get_current_user() in
/home/.../public_html/.../wordpress/wp-includes/user.php on line 215
"So the problem is that the developers have changed the WP_query object so
that the WP_query->get_posts function no longer uses a global variable for
the user id and it now calls the get_current_user_id function which calls
wp_get_current_user which only exists after pluggable.php has been
included. If I include pluggable.php its going to make the functions in
pluggable.php static and will no longer be able to be overridden."

This patches it.

You need to add this line to the top of your CAPABILITIES.PHP file -

require_once ('pluggable.php');

so it looks like this -

<?php

require_once ('pluggable.php');
/**
* WordPress Roles and Capabilities.


Cheers,


Glenn S. Tate



GT Management Systems
Dion Hulse (dd32)
2013-10-25 22:52:30 UTC
Permalink
Unfortunately this is a pretty standard Plugin Developer error :(

No plugin should be executing code upon plugin inclusion (other than
add_action/add_filter/object instantiation), especially not get_posts().
We've got hooks available (plugins_loaded, init, template_redirect) where
plugins can run their on-inclusion code, and running it earlier will pretty
much guarantee breakage at some point in the future - As the error shows,
WordPress hasn't even fully set up it's environment when the plugin is
doing stuff.

The authors fix is a workaround, a bad one, and they should really delay
executing get_posts until plugins_loaded or preferably, init, if they
really have to run it on every page load.
Post by Glenn Tate
Call to undefined function wp_get_current_user() in
/home/.../public_html/.../wordpress/wp-includes/user.php on line 215
"So the problem is that the developers have changed the WP_query object so
that the WP_query->get_posts function no longer uses a global variable for
the user id and it now calls the get_current_user_id function which calls
wp_get_current_user which only exists after pluggable.php has been
included. If I include pluggable.php its going to make the functions in
pluggable.php static and will no longer be able to be overridden."
This patches it.
You need to add this line to the top of your CAPABILITIES.PHP file -
require_once ('pluggable.php');
so it looks like this -
<?php
require_once ('pluggable.php');
/**
* WordPress Roles and Capabilities.
Cheers,
Glenn S. Tate
GT Management Systems
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...