• Resolved David

    (@edrifter)


    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 14 replies - 16 through 29 (of 29 total)
  • Thread Starter David

    (@edrifter)

    I was also able to (trial and error)narrow the error to a single plugin, which works on the main site but causes this error when set to ‘network activated’

    Not all plugins are meant to be network activated.

    Thanks Andrea_r,
    I simply renamed plugins to plugins2, then went to the Network Admin page without issue, then renamed plugins2 back to plugins and it has cleared up my issue. I love a good quick fix.

    It seems I have found what causes problem but not why it is causing a problem.

    On my plugin the problem was because there was a file called settings.php. After renaming it to something else the error disappeared!

    I just don’t know why settings.php causes error in network mode.

    The problem was correctly diagnosed by Andrew Nacin above.

    Some plugins try to call various user functions as soon as they are loaded, so the user function they need is not available yet. These calls should be added to the ‘init’ action to make sure the WP environment is fully loaded and available to use.

    OMG, that’s it… I ran into the same with Easy Nivo Slider plugin activated on the first site in my network blocking access to the Network Admin section. And indeed it has a file called settings.php. And a similar thing happens when there is a file called options.php: the Site Admin section is no longer accessible.

    Disabling the plugin solved the issue. Then after renaming the file settings.php to(for example) settings-form.php and editing the include statement to keep funcitonality of the plugin itself, I could run both the plugin and access Network Admin at the same time.

    To replicate the issue:
    – Do a clean WP install and upgrade to Multi Site;
    – install Easy Nivo Slider or any other plugin that has a file called settings.php or options.php in it;
    – enable it on the main site;
    – try to access the Network Admin section…

    To solve:
    – rename the plugins file settings.php or options.php to anything else
    – adapt the include statement in the main plugin file to reflect the new name

    Conclusion:
    When a plugin file bears the name settings.php, Network Admin is blocked. When a plugin includes a plugin file called options.php, the Site Admin is blocked.

    It looks to me like this is a WordPress bug. I’ve only tested this on a 3.2.1 multi-site install that has been recently upgraded from 3.0 so no idea if this behaviour always occurs but in theory, it should not matter how individual plugin files are named. Or am I mistaken?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    RavanH – I think that should go in trac. I’m not sure it’s a bug, but it should be at least looked at. I can’t find an extant ticket on that.

    Hi Ipstenu, I’ve never submitted to trac before… please allow me some time ??

    Can you replicate this maybe? Or is it caused by other plugins on the same install. In my case, the Easy Nivo Slider was the only plugin activated on the main site but there are others installed and running on other sites in the network…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Was it network activated or per-site?

    per site, and only activated on the main site… activated on a sub site has no effect.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Works fine for me on 3.3

    I see this happening on a 3.1.4 and 3.2.4 multi-site install. Both with the same other plugins installed but not running.

    What happens if you rename the settings.php to options.php and adjust the include statement in the main plugin file accordingly?

    When I get the time, i’ll do some testing with a clean install…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Still no problems.

    I spun up my local install and it worked fine too, but that’s also on 3.3. … Wonder if they fixed it.

    I just ran into this with my plugin (FoxyShop). I had actually discovered a while back that using the filename “tools.php” in my plugin caused major trouble in regular WordPress. I just discovered that setup.php and settings.php are what were causing my plugin to bork multisite (in 3.2.1 – haven’t tested 3.3 with this yet). I renamed settings and setup (tools had already been renamed) and now the plugin works like a charm.

    My conjecture is that the files (settings, setup, tools, options) are protected for some reason and when they are called they initialize current_user_can() or a subset of that.

    Come to think of it, shortcode.php and widget.php also broke my plugin.

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘Fatal error: Call to undefined function wp_get_current_user()’ is closed to new replies.