Forums

get_currentuserinfo does not work!! (5 posts)

  1. raulsan
    Member
    Posted 3 years ago #

    Hello,
    I have a plugin that creates a new menu in the admin_menu, for this I use the file "menu-panels.php" which is the main file for the plugin. Where I do the add_actions(__,__) necesary.

    From there, I go to a new page (add-panel.php) where I have created a form with a submit buttom. This is because I need some operations to obtain the power of a solar panel produces. So, when I press the submit I go to calculate-pw.php, and here I need to get information about the user because I am going to introduce some data in the database.
    But when I call the function get_currentuserinfo() I get

    Fatal error: Call to undefined function get_gurrentuserinfo()

    I only have one plugin, this one, so there cannot be incompatibilities.

    I clean the variable doing a:
    global $current_user;
    get_currentuserinfo();
    PLEASE can somebody help!?

    I know that if I call the function get_currentuserinfo() from the main page of the plugin "menu-panels.php" in this way:

    add_action('init','obtain_user');
    
    	function obtain_user(){
    		global $current_user;
    		get_currentuserinfo();
    	}

    It works!

    but I do not need that information here, I need the information only when the user wants to create a new panel.

    THANK YOU!

  2. raulsan
    Member
    Posted 3 years ago #

    "come on"
    "someone shall know"

  3. raulsan
    Member
    Posted 3 years ago #

    "PLEASE"

  4. whooami
    Member
    Posted 3 years ago #

    youre not doing yourself any favors by being impatient.

    that particular function is defined inside pluggable.php. if you have done your homework, and actually read that file, you would realize that its loaded AFTER all the plugins are loaded.

    therein lies your problem.

    now stop being a petulant child.

  5. raulsan
    Member
    Posted 3 years ago #

    I am sorry if I bother you or any other, it was never my intention.

    I have read the pluggable.php and I have tryed including it in my file but if I do this I have to include also plugin.php, functions.php, capabilities.php.
    I do not know how to access to one function in pluggable.php without having to call other modules..

Topic Closed

This topic has been closed to new replies.

About this Topic