Skip to content

Commit 3dda7c0

Browse files
authored
Merge pull request #126 from Emilia-Capital/jdv/fix-comment-policy
Allow changing comments when you have comment moderation rights
2 parents 5851e48 + 0004342 commit 3dda7c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

inc/forms.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public function comment_form_fields() {
5353
public function check_comment_policy( $comment_data ) {
5454
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Comment forms (unfortunately) are always without nonces.
5555
if ( ! isset( $_POST['comment_policy'] ) || ! ( $_POST['comment_policy'] === 'on' || $_POST['comment_policy'] === true ) ) {
56-
\wp_die( \esc_html( $this->options['comment_policy_error'] ) . '<br /><br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'comment-hacks' ) . '</a>' );
56+
if ( ! \current_user_can( 'moderate_comments' ) ) {
57+
\wp_die( \esc_html( $this->options['comment_policy_error'] ) . '<br /><br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'comment-hacks' ) . '</a>' );
58+
}
5759
}
5860

5961
return $comment_data;

0 commit comments

Comments
 (0)