• Hi, when activating the plugin I keep getting this error:

    Fatal error: Call to undefined function wp_get_current_user() in /home1/meincont/public_html/wp-includes/capabilities.php on line 1059

    I am running WP 3.1 with Mulltisites….

    Can somebody provide a fix?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same Error here, only my fatal error is in capabilities.php on line 590. Does anyone know how to fix this?

    Hi there,

    In short, the plugin is trying to look and see what level the logged-in user is. It’ll find that information in capabilities.php but it needs to use a function to do that (that function is wp_get_current_user().

    Plugin code fires in WordPress before this function is defined, so, your plugin breaks upon not knowing what wp_get_current_user() is.

    A workaround is to define that function within the plugin. You can do this by including pluggable.php, the file where these kinds of functions are.

    So insert this line near the top of your plugin:

    include_once(ABSPATH . 'wp-includes/pluggable.php');

    Hi Chrisull,

    Thank you for posting this clear explanation and fix! After nearly pulling my hair out for an hour or two, I have finally stumbled across this workaround and am able to get my current project working again.

    Many thanks!

    What do I need to do if I want to check the user Role instead of the user level?

    Because I´m using custom roles and want to publish content in diferent post types, according to the role the user has…

    Cristiano, I don’t think you can get the user role. A better way would probably be to check if the user can perform a certain task according to their role’s capabilities.

    Use if current_user_can( 'capability_name' ) and use this list of capabilities:

    http://codex.wordpress.org/Roles_and_Capabilities

    I had this same problem, and the include posted above fixed it for me as well. I’m concerned about future updates breaking it, though. Can this be brought to the developer’s attention so it can be fixed in the future? Or is there something unusual about my installation (and those few above) that’s causing a problem where there wouldn’t otherwise be one?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Post From Site] Fatal error: undefined function’ is closed to new replies.