WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Automatic Friends
[resolved] Find user ID (3 posts)

  1. angslycke
    Member
    Posted 2 years ago #

    Hi!

    Is there an easy way to find the user id:s of all the WordPress users on my site? Would be easier to use your plugin if that was possible for those of us who are less skilled in programming.

    Thanks!

    http://wordpress.org/extend/plugins/bp-automatic-friends/

  2. angslycke
    Member
    Posted 2 years ago #

    I found this code at StackOverflow.com (http://stackoverflow.com/questions/2041746/wordpress-get-user-id-by-login-name/9024155#9024155) which was really helpful in finding my own user number:

    <?php
    $user_id = get_current_user_id();
    echo "ID User : ".$user_id ;
    if ($user_id == 0) {
    echo 'You are currently not logged in.';
    } else {
    echo 'You are logged in as user '.$user_id;
    }
    ?>

    I included it in a template file and found my user ID number, which was 14 by the way, a bit unexpected (thought it was 1 or 2).

    Would be helpful if the plugin reported "User not found" when you enter a user id number which isn't found.

    Thanks for a great plugin!

  3. angslycke
    Member
    Posted 2 years ago #

    There's also an easier way to find a users user ID number. In the WP-admin screen, click on "Users" and hover over the username of the user whose user ID you're searching for. The URL will show you the ID:

    /wp-admin/user-edit.php?user_id=17

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic