WordPress.org

Support

Support » Multisite » [Resolved] Fatal error: Call to undefined function wp_get_current_user()

[Resolved] Fatal error: Call to undefined function wp_get_current_user()

  • Well, I’ve mucked this up pretty bad now. While messing around with WP-MS (after auto upgrading 3.0.2) I activated a plugin in my subdoman site which caused me to receive this error:

    Fatal error: Call to undefined function wp_get_current_user() in /home/mysite/mysite.com/wp-includes/capabilities.php on line 1059

    So I went ahead and deleted the site, and the admin user for that site, and recreated them. Still the same Error… any thoughts?

    Also: I thought this was an error that occurred because of my activation of that plugin, but I tried to start a third site (to see if there were just residual files) that new site is also showing the above ‘Fatal error’ Is this a bug from the update?

Viewing 15 replies - 1 through 15 (of 29 total)
  • I’m thinking it could be, yes.

    Ron Rennick

    @wpmuguru

    MultiSite Guru

    I was able to activate a plugin on a sub site in 3.0.2. Have you only tried the one plugin?

    I’d check other plugins installed. I’ve not experienced that issue after upgrading several multi-site installs.

    Oh phew – there was another user having the same issue. no mention of the same steps.

    http://wordpress.org/support/topic/new-multi-sites-dont-appear?replies=10

    I’m totally lost. I just went to update my multisite install and recieved the error Call to undefined function wp_get_current_user(). I went into phpmyadmin and manually disabled all plugins (which is what I should have done beforehand, but hindsight’s 20/20).

    Now I can’t access my root site or any of my sites in sub-directories. I’m having flashbacks to the white screen of death.

    If anyone can help I would truly appreciate it.

    Ok all better. This is like multisite 101. When all else fails make sure to manually disable all plugins across your sites by going into MYSQL and running this query for each of your sites:

    SELECT * FROM wp_options WHERE option_name = ‘active_plugins’;

    Then reinstall WordPress and refresh the page. This is the quintessential step in updating anything multisite and the one I seldom remember. Live and learn I guess.

    My apologies blasting this thread, but something tells me this latest update bug is an issue with W3 Total Cache. I was in the process of reactivating my plugins and the error reoccurred when I attempted to activate W3TC.

    With this otherwise incredible plugin, I have had quite a few problems with W3TC and multisite, particularly with writing .htaccess, and object cache bringing 404 errors on my subdirectories.

    A fairwarning to all multisite newbies: If you are using W3TC make sure it is deactivated EVERYWHERE before updating.

    When all else fails make sure to manually disable all plugins across your sites by going into MYSQL and running this query for each of your sites:

    SELECT * FROM wp_options WHERE option_name = ‘active_plugins’;

    Or rename the plugins folder. 🙂

    W3 Total Cache is working fine for me on a 3.0.2 multisite with BuddyPress and a metric ton of plugins. And I didn’t deactivate before upgrading cause I’m reckless 😉

    That said, I also did a manual upgrade.

    You’re right ipstenu… my bad. W3TC is cool. It was WP Link Directory… what is now becoming a fossil plugin. I’m going to see if there is any magic I can work to bring it up to speed with multisite or atleast see if the developer can point me in the right direction.

    Moderator Andrew Nacin

    @nacin

    Lead Developer

    The issue here is as follows:

    pluggable.php doesn’t get loaded until after all plugins are loaded. This cripples a lot of functions that then rely on, directly or indirectly, wp_get_current_user(), among others.

    We don’t even load the current user until just before the init hook. Doing anything to the current user before the init hook will not work.

    Now, here’s where I think we’re going to have a compatibility problem. While the plugins were certainly doing it wrong, I think we changed a bunch of $current_user references to wp_get_current_user() — one doesn’t fatal when it doesn’t work, and the other obviously does.

    I’m going to investigate some changes and get back to you.

    Moderator Andrew Nacin

    @nacin

    Lead Developer

    The change I’m thinking of is http://core.trac.wordpress.org/changeset/15452. First thing that tipped me off to this not being a problem is that we backported that to 3.0.1, and I haven’t heard too many complaints.

    Second, I don’t see any logic in capabilities.php there. In fact, that line is from current_user_can() itself (which cannot be called before init), which was given the wp_get_current_user() treatment about five years ago:

    http://core.trac.wordpress.org/changeset/3566/trunk/wp-includes/capabilities.php.

    Confession I am a codebaby/hobbiest, and must rely on my limited working knowledge of wordpress. I am going to suggest the following fix:

    1. Backup blog
    2. Delete WordPress (wipe all directory)
    3. Install wordpress
    4. Import blog

    I’m guessing this should work, but If there is a more efficient way please advise.

    I’m so glad I found this post!!!1 Right when I was about to become a screaming banshee (well I did for a moment..)

    I can’t speak for anyone else…but DEFINITELY don’t use the wp-link directory plugin…….got the exact same message when trying to activate plugins after upgrade….it’s what made me post in another thread…

    Removed it from my plugin folder..now everything works fine…

    Hope that helps someone else because it’s just maddening when you’re not sure how to track down what’s not working when you’re a “codebaby”….

    I appreciate what you guys are doing here…..

    Peace

    Start reporting it broke here: http://wordpress.org/extend/plugins/wordpress-link-directory/

    I’ve tagged the post so it’ll show up there.

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘[Resolved] Fatal error: Call to undefined function wp_get_current_user()’ is closed to new replies.