Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter angslycke

    (@angslycke)

    I found this code at StackOverflow.com (https://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!

    Thread Starter angslycke

    (@angslycke)

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: BuddyPress Automatic Friends] Find user ID’ is closed to new replies.