• wp 1.5

    I’m trying to get the archive page to show:

    You're currently viewing <?php echo $curauth->user_nickname; ?>'s Archives

    However, when the User’s name is more than one word (First Last) it only shows:

    You’re currently viewing ‘s Archives

    What could be the cause for this?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter tjinh200

    (@tjinh200)

    replacing what i had before with:

    <?php the_author_nickname(); ?>

    didn’t change anything …

    Did you use it like this:

    You're currently viewing <?php the_author_nickname(); ?>'s Archives

    And you have set the author nickname in the Admin > User Profile?

    And is the tag within the WordPress Loop?

    It should work.

    Thread Starter tjinh200

    (@tjinh200)

    I just double checked everything and yes, it is used like above, and the nickname has been set, and it is within the WP loop …

    It’s odd because it works for names that are only: First
    But not for names that are: First Last

    Thread Starter tjinh200

    (@tjinh200)

    i’ve tried different positioning of this code, but it still only outputs correctly if the nickname is One word long … if it is two words, it does not output the name …

    Well, a nickname is usually a single word, unless you live in the Southern United States ;-). This might be the default usage.

    Have you just tried the author names and skipped the nickname?

    nicknames by definition are a shortened version of a name, rather than a shortened version of the first and last name. The tag is going by the assumption and the logic that the nickname is one word, and therefore its output is one word and not two.

    There might be a way around it, but as it is, I think it’s outputting it correctly therefore you may want to reconsider how you enter the nicknames as one word. so the master would be TheMaster for example.

    Thread Starter tjinh200

    (@tjinh200)

    in an effort to try to get this to work, instead of nickname, I have changed it to:

    <?php the_author('firstname'); ?>

    however, it now does not output any name at all (I have double checked the fields) …

    https://www.ads-software.com/support/topic/27554#post-154787

    Assuming you’re using the php from that to display information on ‘current’ author:

    <?php $curauth->user_firstname; ?>

    Thread Starter tjinh200

    (@tjinh200)

    kafkaesqui, using that information still doesn’t return the correct information for some reason …

    I’ve double and triple check the User Info, and all First Name fields are filled in, yet still with an author with First Last (as opposed to no Last Name listed) I only see: ‘s archives.

    Some points I want to make sure are clear:

    1. $curauth is not a WordPress variable, but a variable created by the php code found at the link above.

    2. This will (or rather, should) work only on author pages (and not general archive pages), that is pages generated through author links, i.e.

    ?author=2
    ?author_name=kaf
    /author/kaf/

    Thread Starter tjinh200

    (@tjinh200)

    yup, I used the code you supplied in the other thread, and it is on an author archive page …

    You could also do:

    <?php
    global $post;
    $authordata = get_userdata($post->post_author);
    echo $authordata->user_nickname;
    ?>

    I should add also, for outside the loop:

    <?php
    global $posts;
    $authordata = get_userdata($posts[0]->post_author);
    echo $authordata->user_nickname;
    ?>

    Thread Starter tjinh200

    (@tjinh200)

    that did it! thanks to all who helped ??

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘error using $curauth->user_nickname’ is closed to new replies.