WordPress.org

Support

Support » Plugins and Hacks » Access User Info from outside WP?

Access User Info from outside WP?

  • Chuchundra
    Participant

    @chuchundra

    I’d like to get the User Info on an external (non-WP) PHP page, but it doesn’t seem to be working.

    I have this in my header:

    <?php
    require(‘news/wp-blog-header.php’);
    require_once(‘news/wp-config.php’);
    ?>

    And then this later on in the page:

    <?php global $userdata;
    get_currentuserinfo();

    echo(‘Username: ‘ . $userdata->user_login . ‘\n’);
    echo(‘User level: ‘ . $userdata->user_level . ‘\n’);
    echo(‘User ID: ‘ . $userdata->ID . ‘\n’);
    ?>

    I’m logged in, but when I go to this external page, it doesn’t show me the user info. What am I missing?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Access User Info from outside WP?’ is closed to new replies.