Skip to content

Instantly share code, notes, and snippets.

@crumina
Created October 7, 2015 17:53
Show Gist options
  • Save crumina/7995cd448186fce9a3f2 to your computer and use it in GitHub Desktop.
Save crumina/7995cd448186fce9a3f2 to your computer and use it in GitHub Desktop.
add links to userpro profiles
<?php
if ( !function_exists('reactor_comments') ) :
function reactor_comments( $comment, $args, $depth ) {
do_action('reactor_comments', $comment, $args, $depth );
global $userpro;
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<p><?php _e('Pingback:', 'crum'); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __('Edit', 'crum'), '<div class="comment-edit-link"><span>', '</span></div>'); ?></p>
<?php
break;
default :
// Proceed with normal comments.
global $post;
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<?php
echo get_avatar( $comment, 70 );
?>
<article id="comment-<?php comment_ID(); ?>" class="comment-entry comment">
<header class="comment-meta comment-author">
<?php
$author_id = get_the_author_id();
printf('<cite class="fn">%1$s </cite>',
$userpro->permalink($author_id)
// If current post author is also comment author, make it known visually
//( $comment->user_id === $post->post_author ) ? '<span> ' . __('Post author', 'crum') . '</span>' : ''
);
$comment_date = strtotime(get_comment_date('Y-m-d').' ' . get_comment_time('H:i:s'));
printf('<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time('c'),
// translators: 1: date, 2: time
human_time_diff( get_comment_time('U'), current_time('timestamp') ) . ' ago'
);
?>
<div class="reply comment-reply-button">
<?php comment_reply_link( array_merge( $args, array('reply_text' => __('Reply', 'crum'), 'before' => '', 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</header><!-- .comment-meta -->
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'crum'); ?></p>
<?php endif; ?>
<div class="comment-content comment">
<?php comment_text(); ?>
<?php edit_comment_link( __('Edit', 'crum'), '<div class="edit-link"><span>', '</span></div>'); ?>
</div><!-- .comment-content -->
</article><!-- #comment-## -->
<?php
break;
endswitch; // end comment_type check
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment