Support » Fixing WordPress » Fatal error: Call to undefined function wp_get_current_user()

  • Hi.

    I have a new site that I’m building, have added in a new Talian theme and all was OK. Went to add the Web Traffic Genius RSS plugin by uploading a zip file.

    As soon as it started to install I received the following error message:

    Fatal error: Call to undefined function wp_get_current_user() in /home/alwinsi1/public_html/healthyinsights.co.uk/wp-includes/capabilities.php on line 1059

    I read another post on this forum that mentioned something about adding require_once(‘pluggable.php’); but I don’t know anything about this type of coding so don’t know where to start. I’m fine with editing the capabilities php file if someone knws how to overcome this.

    The post can be found at: http://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_get_current_user-3?replies=4

    Would it be the new plugin I’m trying to load that’s causing the problem?

    Any help appreciated.

    Regards

    Nigel

Viewing 15 replies - 1 through 15 (of 31 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try re-uploading the wp-includes folder from a fresh download of WordPress. wp_get_current_user has been in core since 2.0.1

    Esmi – the problem isn’t that it isn’t there. Its that current_user_can is being called by the plugin and for some reason although capabilities.php has been loaded (which contains the current_user_can function) that function calls wp_get_current_user which is defined in pluggable.php but hasn’t been loaded when the call is made

    I think its actually a bug in WordPress – the solution is to add a require_once call to the top of capabilities.php.

    Hi Guys and thanks for your inuput.

    You are right Steve it was the “require_once” bit of code that was missing. Received an answer from the plugin coder and he confirmed that this was the case.

    They’ve included a note in their installation pdf files now.

    Thanks
    for your responses.

    regards

    Nigel

    Hi Steve!

    I have a same problem weeks ago whit my new wordpress site.
    Do you said,that a solution is:

    “I think its actually a bug in WordPress – the solution is to add a require_once call to the top of capabilities.php. “

    Im not really a developer.can you explane it for me,that how can i do it?
    Thanks Zoltan

    Actually is looking like this:”Fatal error: Call to undefined function wp_get_current_user() in D:\Program Files\xampp\htdocs\wp-includes\user.php on line 254″ after i want install a new plugin,which already works in other websites.
    but wont work on my:(

    You open capablities.php and add require_once(‘pluggable.php’);
    (but you need to change those quotes to single quotes) right after the opening <?php tag at the top of the file.

    The reason I say its a bug is that there is no way we should get to the point that capabilities has been loaded but pluggable hasn’t.

    Hi SteveAtty!”You open capablities.php and add require_once(‘pluggable.php’);” its works:)Thank you!
    but im not really understad,that what i have to do whit this”(but you need to change those quotes to single quotes) “
    Thanks Zoltan

    If you cut and paste that line from in her then the quotes will be wrong so you need to change them to proper single quotes or you’ll get an error

    LJagermaster

    (@the-living-legend)

    Cheers Steve! Just came across that issue myself when trying to install a couple of “attendance” plugins (after this issue occurred with the first one I deleted and tried the second with the same issue re-occurring)…tried your fix and everything seems fine now 😀

    Oh, and sxpiv – just to clarify, what Steve means about the quotes marks (that surround the pluggable.php portion of the code), if you simply copy/paste it from this page, you’ll notice that they appear at an angle as they do above, and this can muck things up, so if you highlight each of them and hit the single quote button (normally the second button to the left of the “Enter” button, and usually has the @ symbol floating above it) you should see that the angled quotes are replaced by vertical ones – ie. like this one -> ‘

    Suzi Wilson

    (@suziwilson)

    I have the same problem but when I added the code to my capabilities.php (and update the tick marks) it says I don’t have permission to access the Network Admin panel.

    What gives?

    Nothing seems to be working for me lately and I’m getting extremely frustrated. Any help would be appreciated.

    sxpiv

    (@sxpiv)

    Hi suziwilson!How did you but the code in your capabilities.php?

    <?php
    /**
    * WordPress Roles and Capabilities.
    *
    * @package WordPress
    * @subpackage User
    */
    require_once(‘pluggable.php’) ?>

    Like this?

    Suzi Wilson

    (@suziwilson)

    I have this below and now I get a full screen of the capabilities.php in text all scrunched together. 🙁

    <?php
    /**
    * WordPress Roles and Capabilities.
    *
    * @package WordPress
    * @subpackage User
    */
    require_once(‘pluggable.php’) ?>
    /**
    * WordPress User Roles.

    johanhburger

    (@johanhburger)

    Is there some pace I can get an idiot’s guide as to what you are talking about? My blog crashed after an amazon associate update, and I cannot get access to my blog!

    sxpiv

    (@sxpiv)

    suziwilson!
    After this line require_once(‘pluggable.php’) ?>
    You should but there a php open tag.
    So it should looks like this
    <?php
    /**
    * WordPress Roles and Capabilities.
    *
    * @package WordPress
    * @subpackage User
    */
    require_once(‘pluggable.php’) ?>
    <?php
    /**
    * WordPress User Roles.
    if you want,i can send you my capabilities php file.maybe it could help for you.

    sxpiv

    sxpiv

    (@sxpiv)

    johanhburger!
    Did you made security file and DB backup before did you update your site?
    sxpiv

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