feed Posts (RSS | eMail)
feed Comments (RSS | eMail)
Loading in process - please be patient.

Remember the Google Gmail Automatic BCC Option Petition!
[click to close]

I just recently updated my WordPress plugins, and after I downloaded Maintenance Mode (v4.0) and uploaded it onto my WordPress blog, Filosofo Comments Preview threw an error that said:

Call to undefined function get_currentuserinfo()…

That was pretty odd, because both plugins worked fine before – now, after updating one of them, the other one threw an error.

After doing some research, I found this post on the WordPress support forum that says that get_currentuserinfo() is actually defined within pluggable.php which is loaded AFTER all plugins – that means that the function is not yet ready if you call it normally in your plugin.

I found the answer within the code of the Maintenance Mode plugin – you have to manually insert that pluggable.php using the require statement in php.

So, look for this code in Filosofo Comments Preview (should be line 638 in v1.5):

if ( !function_exists('wp_get_current_user') ) {</p>
<p>function wp_get_current_user() {<br />
global $current_user;<br />
get_currentuserinfo();<br />
return $current_user;<br />
}</p>
<p>}

Extend it to this:

if ( !function_exists('wp_get_current_user') ) {</p>
<p>function wp_get_current_user() {</p>
<p>// Insert pluggable.php before calling get_currentuserinfo()<br />
require (ABSPATH . WPINC . '/pluggable.php');</p>
<p>global $current_user;<br />
get_currentuserinfo();<br />
return $current_user;<br />
}</p>
<p>}

I can’t tell if you need require or require_once – all I can say is that both work fine.

The post ends here. Wanna leave a response? Have Your Say!
You can also subscribe to comments without commenting.
BTW: This post has comments.

Next post: Kitten Gets Owned
Previous post: Using Google Translation Service (Part II)

Did you like this post? NoYes
No votes yet, be the first!
Loading ... Loading ...
Share this post with your friends:

Trackback URI | Comments RSS | Permalink

Pingbacks/Trackbacks

Comments

  1. This is
     Comment 
    #1
     Mark
    2009-04-08 @ 07:19:48 +0200 (CEST) | Quote | Permalink 

    Thanks for this wonderful piece of information that saved me losing anymore hair and sleep. After inserting require (ABSPATH . WPINC . ‘/pluggable.php’); before wp_get_current_user() the code worked like a charm. Two days I scoured the WP Codex and the Web.

    ReplyReply
  2. This is
     Comment 
    #2
     Mohan
    2009-08-21 @ 21:10:20 +0200 (CEST) | Quote | Permalink 

    Thanks for the info :)
    A quick google search bought me here.

    ReplyReply

You can subscribe to comments without commenting

Have Your Say!

back to top