Find out which moderator approved comment?

Is there any way to find out what moderators have approved a comment, and then display that information on the front-end?


John says: “This is a great article”
– Approved by Admin1

Solutions Collecting From Web of "Find out which moderator approved comment?"

To record the moderator that approves the comment:

function wpse_comment_moderator_log( $comment ) {
    global $current_user;

    update_comment_meta( $comment->comment_ID, 'approved_by', $current_user->user_login );
add_action( 'comment_unapproved_to_approved', 'wpse_comment_moderator_log' );

To display it after the comment text:

function wpse_display_moderator( $comment_text, $comment ) {
    $approved_by = get_comment_meta( $comment->comment_ID, 'approved_by', true );
    if ( $approved_by ) {
        $comment_text .= " - Approved by $approved_by";
    return $comment_text;
add_filter( 'comment_text', 'wpse_display_moderator', 99, 2 );