Skip to content

Commit

Permalink
Merge pull request #491 from pfefferle/fix/auto-approve-webmention-only
Browse files Browse the repository at this point in the history
Allow "Approve & Always Allow" only for Webmentions
  • Loading branch information
pfefferle authored Sep 27, 2024
2 parents 3f60485 + 9dfda72 commit 5028dc6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,21 @@ public static function comment_row_actions( $actions, $comment ) {

$approve_url = admin_url( 'comment.php' );
$approve_url = add_query_arg( $query, $approve_url );
$status = wp_get_comment_status( $comment );
$protocol = get_comment_meta( $comment->comment_ID, 'protocol' );

if ( ! $protocol || ! in_array( 'webmention', $protocol, true ) ) {
return $actions;
}

$status = wp_get_comment_status( $comment );
if ( 'unapproved' === $status ) {
$actions['domainapprovelist'] = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $approve_url ), esc_attr__( 'Approve & Always Allow', 'webmention' ) );
$actions['domainapprovelist'] = sprintf(
'<a href="%1$s" aria-label="%2$s">%2$s</a>',
esc_url( $approve_url ),
esc_attr__( 'Approve & Always Allow', 'webmention' )
);
}

return $actions;
}

Expand Down

0 comments on commit 5028dc6

Please sign in to comment.