Comments on author profile (4 posts)

  1. nickrita
    Posted 7 years ago #

    We have author-profiles made with author.php.

    Is there any chance to get comments under them, so that one can leave a message for the author in his profile?

    Here: http://www.song-line.eu/?author=3 I tried to put page into page, my author now looks like below, but now every author has the same comment field, but not an individual one, and after any comment the profile is not shown any more.

    I would be very gladful for help.

    <?php get_header(); ?>

    <div id="page">

    <div id="content" class="narrowcolumn">

    if(get_query_var('author_name')) :
    $curauth = get_userdatabylogin(get_query_var('author_name'));
    else :
    $curauth = get_userdata(get_query_var('author'));

    <h2 class="center">Autorenprofil von <?php echo $curauth->nickname; ?></h2>

    here comes the photo and the description and the author's posts, then I tried to insert the comments:

    <!--****Beginning comment field****//-->

    query_posts('pagename=Friends/Songline'); // retrieve the child page of a parent
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class="post">

    <h2 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?> <small> von <?php the_author_posts_link(); ?></small></h2>

    <div class="entrytext">

    <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>


    <?php comments_template('/commentsweg.php'); ?>

    <?php endwhile; else: ?>

    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

    <?php endif; ?>

    <!--****End comment field****//-->

    commentsweg is a commenttemplate that gives comments numbers and lets them appear in descending order.

    The problem with the code is, that I don't know how to get the comment page for the current author (if it is possible).
    query_posts('pagename=Friends/Songline'); // retrieve the child page of a parent

    gives the page for Songline, but instead there should be something like current user, I think.

  2. Samuel B

    Posted 7 years ago #

  3. nickrita
    Posted 7 years ago #

    Thanks samboll,

    I found the solution here:


  4. DaveUCSD
    Posted 7 years ago #

    in the comments.php section, erase the bit where it lists the comment author's name and links to the comment author's website.

    paste this instead:

    $cAuthName= get_comment_author();
    $cAuthID = get_userdatabylogin($cAuthName)->ID;
    $urlString = “?author=$cAuthID”;
    <a href=”<?php echo $urlString ?>” ><?php comment_author() ?></a>

    this should send you to the author's page (ie. http://www.yoursite.com/?author=5 )

    there you have it and there goes 4 hours of my day haha :)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.