Support » Fixing WordPress » Get author nickname from author ID ?

  • I want to turn the “author=#” field from the GET http call into an author name … any ideas ?
    In other words, I have:
    http://mysite/index.php?author=2
    and I want to change that “2” into “johnny boy”, or whatever.
    I need to do this outside the loop.
    cheers,
    e

Viewing 3 replies - 1 through 3 (of 3 total)
  • get_userdata($author);
    If that fails, try:
    get_userdata($_GET['author']);
    Then you can assign user/profile data this way:
    $name = $profile->user_firstname . ' ' . $profile->user_lastname;
    Or perhaps:
    $name = $user->user_nickname;

    cool beans …
    that worked great.

    Actually, this worked and then stopped working … I hadn’t tested with many different authors yet I guess.

    Try this though … so far it is working:

    $myuser = $wpdb->get_row(“SELECT * FROM $tableusers WHERE ID = ‘$author'”);
    $nick = stripslashes($myuser->user_nickname);

    author needs to be passed as a GET variable, or somehow needs to be set. This is the author’s ID, or number, I think.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get author nickname from author ID ?’ is closed to new replies.