Hi all,
I copied twentytwelve_comment() from the functions.php to my child theme to include a "Moderator" badge beside the name if the person commenting is a site admin or editor.
I have this but it only adds badges to the post authors.
printf( '<cite><b class="fn">%1$s</b> %2$s</cite>',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Moderator', 'twentytwelve' ) . '</span>' : '');
I found this snippet but I don't know how to integrate it into the code above.
<?php
$commentator_id = get_comment(get_comment_ID())->user_id;
$commentator_info = get_userdata($commentator_id);
$capabilities = $user_info->wp_capabilities;
if (array_key_exists('editor', $capabilities)) {
// echo markup here
}
?>
I'm hoping someone can show me how to get the first code to work for admins and editors too. Any help is appreciated! Thanks!