WordPress.org

Ready to get started?Download WordPress

Forums

Current Author (67 posts)

  1. Kathy_P
    Member
    Posted 9 years ago #

    Just discovered the purely 1.5 way isn't working as expected. I am using <?php wp_list_authors('optioncount=1&show_fullname=1'); ?> in a custom template for this Page. For most of the authors, when you click on their names, it takes you to the author.php page, but the code <?php echo $curauth->user_nickname; ?> doesn't seem to work--it leaves a blank. Only two authors show up: Chan Stroman and Rundy, and looking at my Authors and Users list I can't see what they have in common that the other authors don't have. Rundy doesn't have the first name and last name fields filled out on his, Chan does. All of the authors have nicknames, which is why I picked that one. Any ideas, Kafkaesqui?

  2. Beel
    Member
    Posted 9 years ago #

    I could be wrong, but looking at the code doesn't the username and nickname have to be the same in order for the nickname to show up? Check that for the two authors who do show up.

  3. Beel
    Member
    Posted 9 years ago #

    Probably because the nickname is used for the permalink?

  4. DaveQ
    Member
    Posted 9 years ago #

    It's pretty stupid that the nickname and the username have to be the same. What is the point in having those variables if you can't assign them to something different?

    If Wp 1.5 can do all of this with just a few tags, why doesn't somebody include a template in the default theme??????????????????????????????

  5. gzenone
    Member
    Posted 9 years ago #

    When someone enters a profile, clicking on their names (at the end of, say, a comment) brings me to the url if they have provided one. Is there a way simply to bring me to the page with the info hat they filled in?

  6. clayfx
    Member
    Posted 9 years ago #

    How is it possible, in the author.php page, and outside the loop, to display the number of posts already written?
    I've try to put:

    <?php $posts = get_usernumposts($user_ID);
    echo $posts;?>

    before the loop, but it destroys it.

    Thanks.

  7. clayfx
    Member
    Posted 9 years ago #

    Finally it works fine with this code:

    <?php $nposts = get_usernumposts($author);
    echo $nposts;?>

  8. saucemaster
    Member
    Posted 8 years ago #

    i am using the code above for 1.5,


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

    but when i click the links on my index page (generated by wp_list_authors, the only author profiles that appear are the authors with single names. one author has a one word login and nick name; her profile shows up fine. other authors have spaces in their logins and nicknames; their profile pages are blank. is there something i can do about this? thanks.

  9. angelicious
    Member
    Posted 8 years ago #

    I started to use WP say few days ago. I am not well versed with the codes used. Anyway, I'd like to display my name or rather my nickname after every blog entry. How do I do it? What should I add or change? I've been searching high and low for the codes or something like that, but I ended up confusing myself even more.

    Here is my blog:

    http://angelicious.ghostelf.com

    Look at my blog entries - my nickname is nowhere to be found, there's no time display. I don't know how and where to change the codes. Please help.

  10. nearlythere
    Member
    Posted 8 years ago #

    You will be happy to find the_author Template Tag in the handy Codex!

    http://codex.wordpress.org/Template_Tags/the_author

    This will require you to edit your template files, probably for the first time, I guess? It's not too hard.

    Open the file located in your directory: wp-content/themes/default/index.php

    Search for: <!-- by <?php the_author() ?> -->

    Lucky you they already but the author link in the template, but used HTML comments so it doesn't appear. So remove the commenting so you only have:

    by <?php the_author() ?>

    Now test it! It should work. Now you can try moving it around to another place like after your post.

    If you go to the main Template Tags page, you can see a whole list of things you can add about your author on each post.
    http://codex.wordpress.org/Template_Tags

  11. joeytrimmer
    Member
    Posted 8 years ago #

    This works great for an author of a post but what about comments. Now is there a way to grab the author profile page for a comment_author? Assuming of course they are an author.

  12. nearlythere
    Member
    Posted 8 years ago #

    here's a simple workaround: in the author profiles in admin area, put the link to their profile page... and it will go to their profile.

    that's the KISS option. :)

  13. joeytrimmer
    Member
    Posted 8 years ago #

    hehe thanks nearlythere...

    theres gotta be a more precise way though right?

    So...you need to check to see if the commenter is an author, if so make the comment_author link go to the author.php page displaying their info.

    does that sound right?

  14. nearlythere
    Member
    Posted 8 years ago #

    whelp, wordpress already does it for you. it's already-built-in functionality.

    if you are logged in, it recognizes you are an author. above the comment form you see:

    Logged in as somebody. Logout »

    ... then... it adds a link to the whatever link you put in your profile.
    .../wp-admin/profile.php

    so i'm saying, just add the link to author page there.

    but if you want it to do it authomagically, just check in the code above the comment form, and maybe you can send it as a hidden field?

  15. joeytrimmer
    Member
    Posted 8 years ago #

    thanks nearlythere, i'd rather not do any workarounds like that. especially with over 20 members, if more sign up I want profiles to be done automatically...

    anyway here is the code you are referring to, it's an interesting idea. Not sure how to implement it.

    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>

  16. joeytrimmer
    Member
    Posted 8 years ago #

    by the way, with help from another thread I was able to output whether or not the user was registered or guest through this code.

    if ($comment->user_id) echo "Registered User";
    else echo "Guest";

    Gotta go to work but how could I make it a link to the author page and which variables to use when calling up the info? My current author page uses:

    curauth->user_url, etc...

  17. sarahd
    Member
    Posted 8 years ago #

    With regard to the DaveQ/Kathy P/Beel discussion earlier, it does seem like there is a problem with the author.php page's function when an author's user name and nickname are not the same. Instead of using the code suggested in the codex (http://codex.wordpress.org/Author_Templates), I used the example from http://centripetalforces.com/2005/04/30/under-the-wp-bonnet-2/, which is referenced in another thread. This lets you work within the loop in your author.php page to show the author's information once, with posts listed after.

  18. badrad
    Member
    Posted 8 years ago #

    Do these methods work in WP 2.0? I can't get them to. I posted here:

    http://wordpress.org/support/topic/51137

    But haven't gotten any responses. None of the methods to access the author information outside of the loop seem to be working in 2.0.

  19. fcaoneyearbible
    Member
    Posted 8 years ago #

    Well, through about 8 hours of trial and error, I thought I almost was close to getting my author template to work right...then suddenly I get nothing but a blank screen.
    My site is http://www.fcaoneyearbible.com

    Here is the code I am using on the author.php page:

    ------begin code--------
    <?php
    if(get_query_var('author_name')) :
    $curauth = get_userdatabylogin(get_query_var('author_name'));
    else :
    $curauth = get_userdata(get_query_var('author'));
    endif;
    ?>
    <?php get_header();?>

    <div id="main">

    <div id="content">

    <h2>About <?php echo $curauth->display_name;?></h3>

      <?php echo $curauth->description; ?>

    <h3>Contact Information for <?php echo $curauth->first_name;?>:</h3>
    user_email;> ?">Contact this author
    AIM Screenname - <?php echo $curauth->aim;?>
    MSN Screenname - <?php echo $curauth->msn;?>
    Yahoo Screenname - <?php echo $curauth->yim;?>
    user_url; ?>">Go to <?php echo $curauth->first_name;?>'s personal web site
    <h3>Posts by <?php echo $curauth->nickname; ?>:</h3>

  20. fcaoneyearbible
    Member
    Posted 8 years ago #

    I don't know what the problem actually was, but I just deleted the author.php and started over ... somehow managing to get something that resembles what I'm trying to do.

  21. kappaluppa
    Member
    Posted 8 years ago #

    sarahd, that link to http://centripetalforces.com/2005/04/30/under-the-wp-bonnet-2/ is not working, and your comment was the closest I've come to finding an answer! Can you tell me how you worked around it when the name and nickname are not the same.

    On my author.php page I am able to get a list of posts, but cannot get author info to show up, even though it is in their profile.

    I've checked the codex and none of the methods are working.

    Here is the code I'm using if anyone wants to take a peak at it and offer some suggestions.

    Thanks,
    Kathy


    <?php get_header(); ?>
    <?php get_sidebar(); ?>

    <div class="main-copy"> <!-- note that main-copy is closed in the footer.php -->
    <div id="content" class="narrowcolumn">

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

    <h2>About: <?php echo $curauth->nickname; ?></h2>
    <dl>
    <dt>Website</dt>
    <dd>user_url; ?>"><?php echo $curauth->user_url; ?></dd>
    <dt>Profile</dt>
    <dd><?php echo $curauth->description; ?></dd>
    </dl>

    </div>

  22. Knuckles10
    Member
    Posted 8 years ago #

    I would like to provide author information on the actual post page. I would need the name and the profile information. My PHP skills are somewhat limited but im sure getting this information into the actual post (single.php) would be easy for someone with more skills. Could someone please let me know the code I need?

  23. sarahd
    Member
    Posted 8 years ago #

    kappaluppa – I actually ended up with more problems on my author pages. I’m now using the same code as you to set the $curauth variable. If an author’s username and nickname aren’t the same, any author information called before the loop doesn’t get displayed, so I’ve put the loop before the author's profile, etc. The only thing missing is the author’s name above the posts, which is a shame. You can check out my author directory if it is any help—currently, for example, the author “Eassum? has a username/nickname issue, but “aleximou? doesn’t. The best solution may just be to make sure the username and nickname match.

  24. DaveQ
    Member
    Posted 8 years ago #

    This entire author page thing seems like a big hunk of junk. I'll just make static pages and wehn WP 9.5 comes out maybe it will be fixed then - ah, who am I kidding?

  25. kappaluppa
    Member
    Posted 8 years ago #

    sarad...
    I looked at your author page and the page with the individual author info is what I am looking for. Can you share the code for that page?
    thanks,
    Kathy

  26. sarahd
    Member
    Posted 8 years ago #

    the relevant code is...


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

    <div class="storytitle"><?php echo $curauth->user_nickname; ?></div>
    <div class="blackheader">Author's Stories</div>
    <div class="text">

    <ul>
    <!-- The Loop -->
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
    <?php the_title(); ?></a>,
    <?php the_time('M d, Y'); ?> under <?php the_category('&');?>

    <?php endwhile; else: ?>
    <p class="text"><?php _e('No stories by this author yet.'); ?>

    <?php endif; ?>
    <!-- End Loop -->
    </ul>
    </div>
    <div class="blackheader">Author's Description</div>
    <div class="text">
    <?php echo the_author_description(); ?>
    </div>
    <div class="vertspacer">�</div>
    <div class="blackheader">Author's Website</div>
    <div class="text"><a>"><?php echo the_author_url(); ?></a></div>

  27. unbeliever
    Member
    Posted 8 years ago #

    Hey folks.

    I’m curious about getting a chronological list of the authors post on my authors page. This morning was my 101 crash course in PhP as I tried to puzzle out what I saw both in these forums and the documentation, but I’m still lost.

    After butchering Kafkaesqui’s code with a sledge hammer I am only able to arrive at the following…

    http://www.mmodig.com/?page_id=267

    The post list under the various authors names doesn’t reflect what they wrote at all, I was wondering what code I would need to insert to simple list their articles by date in chronological order.

    Ta in advance.

  28. Kafkaesqui

    Posted 8 years ago #

    unbeliever, see the info on query_posts():

    http://codex.wordpress.org/Template_Tags/query_posts

    You can use that to initialize each author's post loop with a combination of the 'author' (or 'author_name') and 'showposts' parameters.

  29. unbeliever
    Member
    Posted 8 years ago #

    ta!

  30. tmm
    Member
    Posted 8 years ago #

    thanx for your discussion, it has helped me a lot. Now, I want to include some portraits of my authors in my author's page. Does anyone have an idea? thanx!

Topic Closed

This topic has been closed to new replies.

About this Topic