Skip to content

Commit 5028dc6

Browse files
authored
Merge pull request #491 from pfefferle/fix/auto-approve-webmention-only
Allow "Approve & Always Allow" only for Webmentions
2 parents 3f60485 + 9dfda72 commit 5028dc6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

includes/class-admin.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,21 @@ public static function comment_row_actions( $actions, $comment ) {
195195

196196
$approve_url = admin_url( 'comment.php' );
197197
$approve_url = add_query_arg( $query, $approve_url );
198+
$status = wp_get_comment_status( $comment );
199+
$protocol = get_comment_meta( $comment->comment_ID, 'protocol' );
200+
201+
if ( ! $protocol || ! in_array( 'webmention', $protocol, true ) ) {
202+
return $actions;
203+
}
198204

199-
$status = wp_get_comment_status( $comment );
200205
if ( 'unapproved' === $status ) {
201-
$actions['domainapprovelist'] = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $approve_url ), esc_attr__( 'Approve & Always Allow', 'webmention' ) );
206+
$actions['domainapprovelist'] = sprintf(
207+
'<a href="%1$s" aria-label="%2$s">%2$s</a>',
208+
esc_url( $approve_url ),
209+
esc_attr__( 'Approve & Always Allow', 'webmention' )
210+
);
202211
}
212+
203213
return $actions;
204214
}
205215

0 commit comments

Comments
 (0)