Recent comments on author page?

This function calls all comments by an author and strips every comment to a max-length. Adjust the comment excerpt length when calling the function in your template like wpse19316_author_comments( 100 );.

function wpse19316_author_comments( $length )
{
    $final_length = (int) $length;
    $author_comments = get_comments( array( 'ID' => $GLOBALS['authordata']->ID ) );
    foreach ( $author_comments as $comment )
    {
        $comment_length = sublen( $comment->comment_content );
        $comment_excerpt = $comment->comment_content;
        if ( $comment_length > $final_length )
            $comment_excerpt = substr( $comment->comment_content, $final_length );
        echo $comment_excerpt.'<br />';
    }
}

Leave a Comment