• I want to show some info of current user, so I save the example code in a php file under domain root folder:
    <?php global $current_user;
    get_currentuserinfo();
    echo ‘Username: ‘ . $current_user->user_login . “\n”;
    echo ‘User email: ‘ . $current_user->user_email . “\n”;
    echo ‘User level: ‘ . $current_user->user_level . “\n”;
    echo ‘User first name: ‘ . $current_user->user_firstname . “\n”;
    echo ‘User last name: ‘ . $current_user->user_lastname . “\n”;
    echo ‘User display name: ‘ . $current_user->display_name . “\n”;
    echo ‘User ID: ‘ . $current_user->ID . “\n”;
    ?>
    but when load that page, nothing happens but a blank page.
    How to solve it?
    Thanks!

Viewing 1 replies (of 1 total)
  • Is that the full contents of the php file? Are you accessing that file directly in a browser or is it included in another file. If no, those functions are not defined when the code is executed. In that case you probably want to add the following to the top of your page:

    require(‘./wp-blog-header.php’);

    Since you’re getting a completly blank page though, I’d recommend looking at the php error logs. They should tell you why the page isn’t rendering at all.

    [signature moderated Please read the Forum Rules]

Viewing 1 replies (of 1 total)

The topic ‘get_currentuserinfo error’ is closed to new replies.