WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] User name not showing on author page (5 posts)

  1. kmsiever
    Member
    Posted 8 years ago #

    Hi all,

    I created an author page copying the information from:

    http://codex.wordpress.org/Author_Templates

    The problem I have is that any of the authors who do have more than one word in their nicknames don't have their names displayed.

    For example, if the nickname is "Mary", then it reads:

    Posts by Mary:

    If the nickname is "Kim Siever", then it reads:

    Posts by :

    Any idea why this is?

    I did not modify the code copied from the above URL. My author pages are found at:

    http://www.mydomain.com/author/user/

    I should mention that users with a space in their nicknames are located at something like this:

    http://www.mydomain.com/author/kim-siever/

  2. schestowitz
    Member
    Posted 8 years ago #

    Your URL's are broken at the moment (error 404). I suggest you make the username different from the display name. For example, admin can be renamed 'Site Admin' if necessary, but spaces in username lead to ambiguities. I think a validation step would prevent them from being created (??).

  3. kmsiever
    Member
    Posted 8 years ago #

    Those are sample URLs, not the real ones.

    The usernames in this case are different than the nicknames (what I assume you mean by display name). In my case, for example, my username is kmsiever and my nickname is Kim Siever.

  4. kmsiever
    Member
    Posted 8 years ago #

    I fixed it,

    Instead of:

    <?php
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata(intval($author));
    endif;
    ?>

    I used:

    <?php
    if(isset($_GET['author_name'])) :
    $curauth = get_userdata(intval($author));
    else :
    $curauth = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_nicename = '$queried_name'");
    endif;
    ?>

  5. schestowitz
    Member
    Posted 8 years ago #

    Glad you got it sorted! I was waiting for someone else to give an opinion on this as I was clueless.

Topic Closed

This topic has been closed to new replies.

About this Topic