[wp-hackers] http://wordpress.org/plugins/plugin-organizer/ Breaks 3.7

Dion Hulse (dd32) wordpress at dd32.id.au
Fri Oct 25 22:52:30 UTC 2013


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.


On 26 October 2013 09:38, Glenn Tate <gt at gtmanagement.com> wrote:

> 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
>
>
> From the author:
> "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
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list