• Resolved iLobster

    (@ilobster)


    I’ve searched the forums and read that it can’t work till all the plugins are loaded. how do i get a user’s ID in a plugin?

    Please note, I need to use the user ID in and admin page the plugin is adding to wordpress, so if anyone knows what function calls the welcome message on top, which obviously loads before all this, that would be helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Normally you want to hook into the ‘init’ API hook, which assures everything has loaded (including the ‘pluggable’ functions) before your code is run:

    add_action('init', 'NAME_OF_MY_FUNCTION');

    I need to use the user ID in and admin page

    The user ID is a globally-available var when in the admin pages, so just scope it to global in your plugin first:

    global $user_ID;

    Thread Starter iLobster

    (@ilobster)

    so i should just add this to the top of the plugin script?
    which function should i name? the script has many.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_currentuserinfo() in plugins’ is closed to new replies.