WordPress.org

Ready to get started?Download WordPress

Forums

Access User Info from outside WP? (2 posts)

  1. Chuchundra
    Member
    Posted 8 years ago #

    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?

  2. Austin Matzko
    Member
    Posted 8 years ago #

    You may also need the global variable $user_ID.

Topic Closed

This topic has been closed to new replies.

About this Topic