Changeset 3807202
- Timestamp:
- 11/17/2026 11:07:55 AM (11 hours ago)
- Location:
- yoast-comment-hacks
- Files:
-
- 2 added
- 36 edited
- 1 copied
-
tags/2.1.8 (copied) (copied from yoast-comment-hacks/trunk )
-
tags/2.1.8/admin/admin.php (modified) (14 diffs)
-
tags/2.1.8/admin/assets/js/user-search.js (added)
-
tags/2.1.8/admin/comment-parent.php (modified) (3 diffs)
-
tags/2.1.8/admin/views/comment-parent-box.php (modified) (1 diff)
-
tags/2.1.8/admin/views/config-page.php (modified) (1 diff)
-
tags/2.1.8/comment-hacks.php (modified) (3 diffs)
-
tags/2.1.8/inc/autoload.php (modified) (1 diff)
-
tags/2.1.8/inc/clean-emails.php (modified) (9 diffs)
-
tags/2.1.8/inc/email-links.php (modified) (2 diffs)
-
tags/2.1.8/inc/forms.php (modified) (3 diffs)
-
tags/2.1.8/inc/hacks.php (modified) (4 diffs)
-
tags/2.1.8/inc/length.php (modified) (4 diffs)
-
tags/2.1.8/inc/notifications.php (modified) (4 diffs)
-
tags/2.1.8/inc/progress-planner-tasks.php (modified) (1 diff)
-
tags/2.1.8/inc/progress-planner/comment-moderation.php (modified) (2 diffs)
-
tags/2.1.8/inc/progress-planner/comment-policy.php (modified) (2 diffs)
-
tags/2.1.8/inc/progress-planner/comment-redirect.php (modified) (2 diffs)
-
tags/2.1.8/readme.md (modified) (1 diff)
-
tags/2.1.8/readme.txt (modified) (1 diff)
-
trunk/admin/admin.php (modified) (14 diffs)
-
trunk/admin/assets/js/user-search.js (added)
-
trunk/admin/comment-parent.php (modified) (3 diffs)
-
trunk/admin/views/comment-parent-box.php (modified) (1 diff)
-
trunk/admin/views/config-page.php (modified) (1 diff)
-
trunk/comment-hacks.php (modified) (3 diffs)
-
trunk/inc/autoload.php (modified) (1 diff)
-
trunk/inc/clean-emails.php (modified) (9 diffs)
-
trunk/inc/email-links.php (modified) (2 diffs)
-
trunk/inc/forms.php (modified) (3 diffs)
-
trunk/inc/hacks.php (modified) (4 diffs)
-
trunk/inc/length.php (modified) (4 diffs)
-
trunk/inc/notifications.php (modified) (4 diffs)
-
trunk/inc/progress-planner-tasks.php (modified) (1 diff)
-
trunk/inc/progress-planner/comment-moderation.php (modified) (2 diffs)
-
trunk/inc/progress-planner/comment-policy.php (modified) (2 diffs)
-
trunk/inc/progress-planner/comment-redirect.php (modified) (2 diffs)
-
trunk/readme.md (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
yoast-comment-hacks/tags/2.1.8/admin/admin.php
r3438581 r3807202 3 3 namespace EmiliaProjects\WP\Comment\Admin; 4 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 9 5 10 use EmiliaProjects\WP\Comment\Inc\Hacks; 11 use EmiliaProjects\WP\Comment\Inc\Notifications; 6 12 use WP_Comment; 7 13 use WP_Post; … … 63 69 64 70 \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_discussion_settings_script' ] ); 71 72 \add_action( 'wp_ajax_ch_search_users', [ $this, 'ajax_search_users' ] ); 65 73 66 74 new Comment_Parent(); … … 135 143 && isset( $_GET['comment_id'] ) 136 144 && $_GET['ch_action'] === 'forward_comment' 137 && \wp_verify_nonce( \wp_strip_all_tags( \wp_unslash( $_GET['nonce'] ) ), 'comment-hacks-forward' )138 145 ) { 139 146 $comment_id = (int) $_GET['comment_id']; 140 $comment = \get_comment( $comment_id ); 147 if ( $comment_id <= 0 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_GET['nonce'] ) ), 'comment-hacks-forward_' . $comment_id ) ) { 148 return; 149 } 150 151 $comment = \get_comment( $comment_id ); 152 if ( ! $comment || ! \current_user_can( 'edit_comment', $comment_id ) ) { 153 return; 154 } 141 155 142 156 echo '<div class="msg updated"><p>'; … … 157 171 158 172 if ( ! empty( $this->options['forward_extra'] ) ) { 159 $intro .= $this->options['forward_extra']. "\n\n";173 $intro .= \esc_html( $this->options['forward_extra'] ) . "\n\n"; 160 174 } 161 175 … … 167 181 $intro .= "\n\n"; 168 182 169 $content = \nl2br( $intro . $comment->comment_content);183 $content = \nl2br( $intro . \esc_html( $comment->comment_content ) ); 170 184 171 185 $headers = [ … … 192 206 */ 193 207 public function forward_to_support_action_link( $actions, $comment ): array { 194 if ( empty( $this->options['forward_email'] ) ) {208 if ( empty( $this->options['forward_email'] ) || ! \current_user_can( 'edit_comment', (int) $comment->comment_ID ) ) { 195 209 return $actions; 196 210 } … … 205 219 } 206 220 207 $actions['ch_forward'] = '<a href="' . \esc_url( \admin_url( 'edit-comments.php' ) . '?comment_id=' . $comment->comment_ID . '&ch_action=forward_comment&nonce=' . \wp_create_nonce( 'comment-hacks-forward ') ) . '">' . \esc_html( $label ) . '</a>';221 $actions['ch_forward'] = '<a href="' . \esc_url( \admin_url( 'edit-comments.php' ) . '?comment_id=' . $comment->comment_ID . '&ch_action=forward_comment&nonce=' . \wp_create_nonce( 'comment-hacks-forward_' . $comment->comment_ID ) ) . '">' . \esc_html( $label ) . '</a>'; 208 222 209 223 return $actions; … … 236 250 */ 237 251 public function meta_box_callback( $post ): void { 252 $selected_id = (int) \get_post_meta( $post->ID, self::NOTIFICATION_RECIPIENT_KEY, true ); 253 $selected_name = ''; 254 255 if ( $selected_id > 0 ) { 256 $user = \get_userdata( $selected_id ); 257 if ( $user ) { 258 $selected_name = $user->display_name; 259 } 260 } 261 238 262 ?> 239 263 <input … … 242 266 value="<?php echo \esc_attr( \wp_create_nonce( 'comment_notification_recipient_nonce' ) ); ?>" 243 267 /> 244 <label for="comment_notification_recipient ">268 <label for="comment_notification_recipient_search"> 245 269 <?php \esc_html_e( 'Comment notification recipients:', 'yoast-comment-hacks' ); ?> 246 270 </label> 247 271 <br/> 272 <input 273 type="hidden" 274 name="comment_notification_recipient" 275 id="comment_notification_recipient" 276 value="<?php echo \esc_attr( (string) $selected_id ); ?>" 277 /> 278 <input 279 type="text" 280 id="comment_notification_recipient_search" 281 value="<?php echo \esc_attr( $selected_name ); ?>" 282 placeholder="<?php \esc_attr_e( 'Search for a user...', 'yoast-comment-hacks' ); ?>" 283 class="widefat" 284 autocomplete="off" 285 /> 286 <ul id="comment_notification_recipient_results" style="display:none;margin:0;padding:0;list-style:none;border:1px solid #ddd;background:#fff;max-height:150px;overflow-y:auto;"></ul> 287 <?php if ( $selected_id > 0 ) : ?> 288 <a href="#" id="comment_notification_recipient_clear" style="display:inline;"> 289 <?php \esc_html_e( 'Reset to post author', 'yoast-comment-hacks' ); ?> 290 </a> 291 <?php else : ?> 292 <a href="#" id="comment_notification_recipient_clear" style="display:none;"> 293 <?php \esc_html_e( 'Reset to post author', 'yoast-comment-hacks' ); ?> 294 </a> 295 <?php endif; ?> 296 <p class="description"><?php \esc_html_e( 'Leave empty to use post author.', 'yoast-comment-hacks' ); ?></p> 248 297 <?php 249 250 /** 251 * This filter allows filtering which roles should be shown in the dropdown for notifications. 252 * Defaults to contributor and up. 253 * 254 * @param array $roles Array with user roles. 255 * 256 * @since 1.6.0 257 */ 258 $roles = \apply_filters( 259 'comment_experience\notification_roles', 260 [ 'contributor', 'author', 'editor', 'administrator', 'super-admin' ] 261 ); 262 263 \wp_dropdown_users( 298 } 299 300 /** 301 * AJAX handler for searching users. 302 * 303 * @return void 304 */ 305 public function ajax_search_users(): void { 306 \check_ajax_referer( 'ch_search_users_nonce', 'nonce' ); 307 308 if ( ! \current_user_can( 'edit_posts' ) ) { 309 \wp_send_json_error( 'Unauthorized' ); 310 } 311 312 $search = isset( $_GET['search'] ) ? \sanitize_text_field( \wp_unslash( $_GET['search'] ) ) : ''; 313 314 if ( \strlen( $search ) < 2 ) { 315 \wp_send_json_success( [] ); 316 } 317 318 $users = \get_users( 264 319 [ 265 'se lected' => \get_post_meta( $post->ID, self::NOTIFICATION_RECIPIENT_KEY, true ),266 's how_option_none' => 'Post author',267 ' name' => 'comment_notification_recipient',268 ' id' => 'comment_notification_recipient',269 ' role__in' => $roles,270 'o ption_none_value' => 0,320 'search' => '*' . $search . '*', 321 'search_columns' => [ 'display_name', 'user_nicename' ], 322 'role__in' => Notifications::get_allowed_roles(), 323 'number' => 20, 324 'orderby' => 'display_name', 325 'order' => 'ASC', 271 326 ] 272 327 ); 328 329 $results = []; 330 foreach ( $users as $user ) { 331 $results[] = [ 332 'id' => $user->ID, 333 'name' => $user->display_name, 334 ]; 335 } 336 337 \wp_send_json_success( $results ); 273 338 } 274 339 … … 293 358 * Enqueue our admin script. 294 359 * 295 * @return void 296 */ 297 public function enqueue(): void { 360 * @param string $hook_suffix The current admin page. 361 * 362 * @return void 363 */ 364 public function enqueue( $hook_suffix ): void { 298 365 $page = \filter_input( \INPUT_GET, 'page' ); 299 366 … … 314 381 ); 315 382 } 383 384 if ( $hook_suffix === 'post.php' || $hook_suffix === 'post-new.php' ) { 385 \wp_enqueue_script( 386 'emiliaprojects-comment-hacks-user-search', 387 \plugins_url( 'admin/assets/js/user-search.js', \EMILIA_COMMENT_HACKS_FILE ), 388 [ 'jquery' ], 389 \EMILIA_COMMENT_HACKS_VERSION, 390 true 391 ); 392 393 \wp_localize_script( 394 'emiliaprojects-comment-hacks-user-search', 395 'chUserSearch', 396 [ 397 'ajax_url' => \admin_url( 'admin-ajax.php' ), 398 'nonce' => \wp_create_nonce( 'ch_search_users_nonce' ), 399 ] 400 ); 401 402 \wp_add_inline_style( 403 'wp-admin', 404 '#comment_notification_recipient_results li { padding: 5px; margin: 0; cursor: pointer; } #comment_notification_recipient_results li:hover { background: #f0f0f1; }' 405 ); 406 } 316 407 } 317 408 … … 325 416 public function save_reroute_comment_emails( $post_id ): void { 326 417 327 if ( ! isset( $_POST['comment_notification_recipient'] ) || ! \wp_verify_nonce( \filter_input( \INPUT_POST, 'comment_notification_recipient_nonce' ), 'comment_notification_recipient_nonce' ) ) { 418 if ( 419 ! isset( $_POST['comment_notification_recipient'], $_POST['comment_notification_recipient_nonce'] ) 420 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_POST['comment_notification_recipient_nonce'] ) ), 'comment_notification_recipient_nonce' ) 421 || ! \current_user_can( 'edit_post', $post_id ) 422 ) { 328 423 return; 329 424 } 330 425 331 $recipient_id = (int) \sanitize_key( \wp_unslash( $_POST['comment_notification_recipient'] ) ); 332 if ( $recipient_id > 0 ) { 426 $recipient_id = \filter_var( \wp_unslash( $_POST['comment_notification_recipient'] ), \FILTER_VALIDATE_INT ); 427 if ( $recipient_id === 0 ) { 428 \delete_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY ); 429 } 430 elseif ( $recipient_id > 0 && Notifications::is_allowed_recipient( $recipient_id ) ) { 333 431 \update_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY, $recipient_id ); 334 432 } … … 402 500 */ 403 501 private function sanitize_bool( $value ): bool { 404 return ( $value || ! empty( $value ) );502 return (bool) $value; 405 503 } 406 504 … … 478 576 '<code style="background-color: #eee; margin: 0; padding: 0;">', 479 577 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- This is only shown in debug mode. 480 \highlight_string( "<?php\n\$this->options = " . \var_export( $this->options, true ) . ';', true ), 481 $num 578 \highlight_string( "<?php\n\$this->options = " . \var_export( $this->options, true ) . ';', true ) 482 579 ); 483 580 ?> -
yoast-comment-hacks/tags/2.1.8/admin/comment-parent.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Admin; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 34 39 */ 35 40 public function load_comment_parent_box() { 36 if ( \function_exists( 'add_meta_box' ) ) { 37 \add_meta_box( 38 'comment_parent', 39 \esc_html__( 'Comment Parent', 'yoast-comment-hacks' ), 40 [ 41 $this, 42 'comment_parent_box', 43 ], 44 'comment', 45 'normal' 46 ); 47 } 41 \add_meta_box( 42 'comment_parent', 43 \esc_html__( 'Comment Parent', 'yoast-comment-hacks' ), 44 [ 45 $this, 46 'comment_parent_box', 47 ], 48 'comment', 49 'normal' 50 ); 48 51 } 49 52 … … 51 54 * Updates the comment parent field. 52 55 * 56 * @param int $comment_id The comment ID supplied by the edit_comment hook. 57 * 53 58 * @return void 54 59 */ 55 public function update_comment_parent() { 56 $comment_parent = \filter_input( \INPUT_POST, 'epch_comment_parent', \FILTER_VALIDATE_INT ); 57 $comment_id = \filter_input( \INPUT_POST, 'comment_ID', \FILTER_VALIDATE_INT ); 58 $action = \filter_input( \INPUT_POST, 'action' ); 59 60 if ( $action === 'edit-comment' ) { 61 return; // We're on the quick edit screen. As the comment parent isn't sent along here, we might lose it if we do anything. 60 public function update_comment_parent( $comment_id ) { 61 if ( 62 ! \is_admin() || \wp_doing_ajax() 63 || ! isset( $_POST['action'], $_POST['comment_ID'], $_POST['epch_comment_parent'], $_POST['_wpnonce'] ) 64 || $_POST['action'] !== 'editedcomment' 65 || (int) $_POST['comment_ID'] !== (int) $comment_id 66 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_POST['_wpnonce'] ) ), 'update-comment_' . $comment_id ) 67 || ! \current_user_can( 'edit_comment', $comment_id ) 68 ) { 69 return; 62 70 } 63 71 64 if ( empty( $comment_id ) && empty( $comment_parent) ) {65 return; // There might be another reason for a comment to be updated.72 if ( ! \is_string( $_POST['epch_comment_parent'] ) ) { 73 return; 66 74 } 67 75 68 if ( \function_exists( 'wp_doing_ajax' ) && \wp_doing_ajax() ) { 69 \check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 76 // An emptied field means "no parent", as it did before this field was validated. 77 $raw_parent = \sanitize_text_field( \wp_unslash( $_POST['epch_comment_parent'] ) ); 78 $comment_parent = ( $raw_parent === '' ) ? 0 : \filter_var( $raw_parent, \FILTER_VALIDATE_INT ); 79 $comment = \get_comment( $comment_id ); 80 if ( $comment_parent === false || $comment_parent < 0 || ! $comment || $comment_parent === (int) $comment_id ) { 81 return; 70 82 } 71 83 72 if ( ! \function_exists( 'wp_doing_ajax' ) || ! \wp_doing_ajax() ) { 73 \check_admin_referer( 'update-comment_' . $comment_id ); 84 // Reject missing parents, parents on other posts, and circular threads. 85 $ancestor_id = $comment_parent; 86 $seen = [ (int) $comment_id ]; 87 while ( $ancestor_id > 0 ) { 88 $parent = \get_comment( $ancestor_id ); 89 if ( ! $parent || (int) $parent->comment_post_ID !== (int) $comment->comment_post_ID || \in_array( $ancestor_id, $seen, true ) ) { 90 return; 91 } 92 $seen[] = $ancestor_id; 93 $ancestor_id = (int) $parent->comment_parent; 74 94 } 75 95 76 if ( ! isset( $comment_parent ) ) { 77 $comment_parent = 0; 78 } 79 80 if ( $comment_id ) { 81 $comment = \get_comment( $comment_id ); 82 $comment->comment_parent = $comment_parent; 83 84 // Remove our filter, or we'll keep looping. 85 \remove_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 86 \wp_update_comment( (array) $comment ); 87 88 // Add our filter back. 89 \add_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 90 } 96 // Remove our filter, or we'll keep looping. 97 \remove_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 98 \wp_update_comment( 99 [ 100 'comment_ID' => $comment_id, 101 'comment_parent' => $comment_parent, 102 ] 103 ); 104 \add_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 91 105 } 92 106 } -
yoast-comment-hacks/tags/2.1.8/admin/views/comment-parent-box.php
r3438581 r3807202 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 2 7 /** 3 8 * Parent Box view. -
yoast-comment-hacks/tags/2.1.8/admin/views/config-page.php
r3438581 r3807202 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 7 // phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName 8 2 9 /** 3 10 * Config page admin view. 4 11 * 5 * @var Admin $this12 * @var \EmiliaProjects\WP\Comment\Admin\Admin $this 6 13 */ 7 14 8 use EmiliaProjects\WP\Comment\Admin\Admin;9 15 use EmiliaProjects\WP\Comment\Inc\Hacks; 10 16 -
yoast-comment-hacks/tags/2.1.8/comment-hacks.php
r3438581 r3807202 5 5 * @wordpress-plugin 6 6 * Plugin Name: Comment Experience 7 * Version: 2.1. 77 * Version: 2.1.8 8 8 * Plugin URI: https://progressplanner.com/plugins/comment-experience/ 9 9 * Description: Improve the comment experience on your site. Adds lots of features to make commenting easier and more engaging. … … 31 31 */ 32 32 33 if ( ! defined( 'ABSPATH' ) ) { 34 exit; 35 } 36 33 37 use EmiliaProjects\WP\Comment\Inc\Autoload; 34 38 use EmiliaProjects\WP\Comment\Inc\Hacks; … … 37 41 * Used for version checks. 38 42 */ 39 define( 'EMILIA_COMMENT_HACKS_VERSION', '2.1. 6' );43 define( 'EMILIA_COMMENT_HACKS_VERSION', '2.1.8' ); 40 44 41 45 /** -
yoast-comment-hacks/tags/2.1.8/inc/autoload.php
r3265034 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** -
yoast-comment-hacks/tags/2.1.8/inc/clean-emails.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use WP_Comment; … … 10 15 */ 11 16 class Clean_Emails { 12 13 /**14 * Holds the current comment's ID.15 */16 private int $comment_id = 0;17 17 18 18 /** … … 148 148 $this->comment_moderation_actions(); 149 149 $this->message .= ' | ' . \sprintf( 150 '<a href=" http://ip-lookup.net/index.php?ip=%1$s">%2$s</a>',151 $this->comment->comment_author_IP,150 '<a href="%1$s">%2$s</a>', 151 \esc_url( 'https://ip-lookup.net/index.php?ip=' . \rawurlencode( $this->comment->comment_author_IP ) ), 152 152 \esc_html__( 'Whois', 'yoast-comment-hacks' ) 153 153 ); … … 177 177 */ 178 178 private function add_author_line(): void { 179 if ( $this->comment->comment_type === 'comment' ) {179 if ( $this->comment->comment_type !== 'pingback' && $this->comment->comment_type !== 'trackback' ) { 180 180 /* translators: %1$s is replaced with the comment author's name, %2$s is replaced with the comment author's email */ 181 181 $this->message .= \sprintf( \esc_html__( 'Author: %1$s (%2$s)', 'yoast-comment-hacks' ), \esc_html( $this->comment->comment_author ), '<a href="' . \esc_url( 'mailto:' . $this->comment->comment_author_email ) . '">' . \esc_html( $this->comment->comment_author_email ) . '</a>' ) . '<br />'; … … 193 193 */ 194 194 private function add_content_line(): void { 195 if ( $this->comment->comment_type === 'comment' ) {195 if ( $this->comment->comment_type !== 'pingback' && $this->comment->comment_type !== 'trackback' ) { 196 196 $this->message .= \esc_html__( 'Comment:', 'yoast-comment-hacks' ); 197 197 } … … 200 200 } 201 201 202 $this->message .= '<br />' . \wpautop( $this->comment->comment_content) . '<br />';202 $this->message .= '<br />' . \wpautop( \esc_html( $this->comment->comment_content ) ) . '<br />'; 203 203 } 204 204 … … 232 232 */ 233 233 private function setup_data( int $comment_id ): void { 234 $this->comment_id = $comment_id; 235 $this->comment = \get_comment( $this->comment_id ); 236 $this->post = \get_post( (int) $this->comment->comment_post_ID ); 234 $this->comment = \get_comment( $comment_id ); 235 $this->post = \get_post( (int) $this->comment->comment_post_ID ); 237 236 } 238 237 … … 300 299 */ 301 300 private function comment_action_links( array $actions ): void { 302 $links = '';301 $links = []; 303 302 foreach ( $actions as $action => $label ) { 304 $links .= $this->comment_action_link( $label, $action ) . ' | '; 305 } 306 307 $links = \rtrim( $links, '| ' ); 308 309 $this->message .= $links; 303 $links[] = $this->comment_action_link( $label, $action ); 304 } 305 306 $this->message .= \implode( ' | ', $links ); 310 307 } 311 308 … … 319 316 */ 320 317 private function comment_action_link( string $label, string $action ): string { 321 $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment _id) );318 $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment->comment_ID ) ); 322 319 323 320 return '<a href="' . \esc_url( $url ) . '">' . \esc_html( $label ) . '</a>'; -
yoast-comment-hacks/tags/2.1.8/inc/email-links.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 46 51 */ 47 52 public function admin_bar_comment_link(): void { 48 if ( ! \ is_singular() || $this->options['disable_email_all_commenters'] ) {53 if ( ! \current_user_can( 'moderate_comments' ) || ! \is_singular() || $this->options['disable_email_all_commenters'] ) { 49 54 return; 50 55 } -
yoast-comment-hacks/tags/2.1.8/inc/forms.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 use WP_Error; 6 use WP_REST_Request; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 4 12 5 13 /** … … 31 39 public function init() { 32 40 $this->options = Hacks::get_options(); 33 Hacks::get_defaults();34 41 35 42 if ( $this->options['comment_policy'] ) { 36 43 \add_action( 'comment_form_after_fields', [ $this, 'comment_form_fields' ] ); 44 \add_action( 'comment_form_logged_in_after', [ $this, 'comment_form_fields' ] ); 37 45 \add_filter( 'preprocess_comment', [ $this, 'check_comment_policy' ] ); 46 \add_filter( 'rest_pre_insert_comment', [ $this, 'check_rest_comment_policy' ], 10, 2 ); 38 47 } 39 48 } … … 72 81 return $comment_data; 73 82 } 83 84 /** 85 * Require explicit policy acceptance for new REST comments. 86 * 87 * @param array<string, string|int>|WP_Error $comment_data Prepared comment data. 88 * @param WP_REST_Request $request The REST request. 89 * 90 * @return array<string, string|int>|WP_Error 91 */ 92 public function check_rest_comment_policy( $comment_data, WP_REST_Request $request ) { 93 if ( \is_wp_error( $comment_data ) || \current_user_can( 'moderate_comments' ) ) { 94 return $comment_data; 95 } 96 97 $accepted = $request->get_param( 'comment_policy' ); 98 if ( $accepted !== 'on' && $accepted !== true ) { 99 return new WP_Error( 'comment_experience_policy', $this->options['comment_policy_error'], [ 'status' => 400 ] ); 100 } 101 102 return $comment_data; 103 } 74 104 } -
yoast-comment-hacks/tags/2.1.8/inc/hacks.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use EmiliaProjects\WP\Comment\Admin\Admin; … … 161 166 $comment = \get_comment( $comment_id ); 162 167 163 if ( isset( $comment ) &&$comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) {168 if ( $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) { 164 169 return \sprintf( 165 170 '<a href="#" class="comment-remove-url" data-comment-id="%d" aria-label="%s">%s</a>', … … 251 256 } 252 257 } 253 254 258 // Only change $url when the page option is actually set and not zero. 255 if ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) {259 elseif ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { 256 260 $url = \get_permalink( (int) $this->options['redirect_repeat_page'] ); 257 261 … … 283 287 private function get_option_from_cache( string $option ) { 284 288 $options = \wp_load_alloptions(); 285 return isset( $options[ $option ] ) ? $option : false;289 return isset( $options[ $option ] ) ? $options[ $option ] : false; 286 290 } 287 291 -
yoast-comment-hacks/tags/2.1.8/inc/length.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 use WP_Error; 6 7 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 } 4 11 5 12 /** … … 23 30 // Process the comment and check it for length. 24 31 \add_filter( 'preprocess_comment', [ $this, 'check_comment_length' ] ); 32 \add_filter( 'rest_pre_insert_comment', [ $this, 'check_rest_comment_length' ] ); 25 33 26 34 // Add a message to the comment form, before the comment textarea, to inform the user about the allowed comment length. … … 38 46 */ 39 47 public function check_comment_length( $comment_data ): array { 40 // Bail early for editors and admins, they can leave short or long comments if they want. 41 if ( \current_user_can( 'edit_posts' ) ) { 48 $error = $this->get_length_error( $comment_data['comment_content'] ); 49 if ( $error !== '' ) { 50 \wp_die( \esc_html( $error ) . '<br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'yoast-comment-hacks' ) . '</a>' ); 51 } 52 return $comment_data; 53 } 54 55 /** 56 * Apply the same length limits to new REST comments. 57 * 58 * @param array<string, string|int>|WP_Error $comment_data Prepared comment data. 59 * 60 * @return array<string, string|int>|WP_Error 61 */ 62 public function check_rest_comment_length( $comment_data ) { 63 if ( \is_wp_error( $comment_data ) ) { 42 64 return $comment_data; 43 65 } 44 66 45 $length = $this->get_comment_length( $comment_data['comment_content'] ); 67 $error = $this->get_length_error( ( $comment_data['comment_content'] ?? '' ) ); 68 if ( $error !== '' ) { 69 return new WP_Error( 'comment_experience_length', $error, [ 'status' => 400 ] ); 70 } 71 return $comment_data; 72 } 73 74 /** 75 * Get a validation message for a comment's length. 76 * 77 * @param string $content Comment content. 78 * 79 * @return string 80 */ 81 private function get_length_error( string $content ): string { 82 // Preserve the existing exemption for users who can edit posts. 83 if ( \current_user_can( 'edit_posts' ) ) { 84 return ''; 85 } 86 87 $length = $this->get_comment_length( $content ); 46 88 47 89 // Check for comment length and die if too short or too long. 48 $error = false;90 $error = ''; 49 91 if ( $length < $this->options['mincomlength'] ) { 50 92 $error = $this->options['mincomlengtherror']; … … 54 96 } 55 97 56 if ( $error ) { 57 \wp_die( \esc_html( $error ) . '<br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'yoast-comment-hacks' ) . '</a>' ); 58 } 59 return $comment_data; 98 return $error; 60 99 } 61 100 -
yoast-comment-hacks/tags/2.1.8/inc/notifications.php
r3218529 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 19 24 20 25 /** 26 * Get the roles eligible to receive comment notifications. 27 * 28 * @return string[] 29 */ 30 public static function get_allowed_roles(): array { 31 /** 32 * Filter which roles may receive notifications. Defaults to contributor and up. 33 * 34 * @param string[] $roles Array with user roles. 35 * 36 * @since 1.6.0 37 */ 38 return \apply_filters( 39 'comment_experience\notification_roles', 40 [ 'contributor', 'author', 'editor', 'administrator', 'super-admin' ] 41 ); 42 } 43 44 /** 45 * Check recipient eligibility when saving and sending notifications. 46 * 47 * @param int $user_id The proposed recipient. 48 * 49 * @return bool 50 */ 51 public static function is_allowed_recipient( int $user_id ): bool { 52 $user = \get_userdata( $user_id ); 53 54 return $user && $user->user_email !== '' && \array_intersect( $user->roles, self::get_allowed_roles() ) !== []; 55 } 56 57 /** 21 58 * Filter the recipients of the comment notification. 22 59 * … … 28 65 public function filter_notification_recipients( $recipients, $comment_id ): array { 29 66 $comment = \get_comment( $comment_id ); 67 if ( ! $comment ) { 68 return $recipients; 69 } 30 70 31 71 $new_recipient = \get_post_meta( (int) $comment->comment_post_ID, '_comment_notification_recipient', true ); 32 72 33 if ( ! empty( $new_recipient ) ) {73 if ( ! empty( $new_recipient ) && self::is_allowed_recipient( (int) $new_recipient ) ) { 34 74 $user = \get_userdata( $new_recipient ); 35 75 36 return [ $user->user_email ]; 76 if ( $user ) { 77 return [ $user->user_email ]; 78 } 37 79 } 38 80 … … 51 93 $comment = \get_comment( $comment_id ); 52 94 53 if ( $comment->comment_author !== '' && $comment->comment_author_email !== '' ) { 54 $name = \esc_html( $comment->comment_author ); 55 $message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n"; 56 95 if ( $comment->comment_author_email === '' ) { 57 96 return $message_headers; 58 97 } 59 98 60 if ( $comment->comment_author_email !== '' ) { 61 $message_headers .= "\nReply-To: $comment->comment_author_email <$comment->comment_author_email>\n"; 99 $name = ( $comment->comment_author !== '' ) ? \esc_html( $comment->comment_author ) : $comment->comment_author_email; 62 100 63 return $message_headers; 64 } 101 $message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n"; 65 102 66 103 return $message_headers; -
yoast-comment-hacks/tags/2.1.8/inc/progress-planner-tasks.php
r3290299 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use Progress_Planner\Suggested_Tasks\Tasks\Providers\Provider; -
yoast-comment-hacks/tags/2.1.8/inc/progress-planner/comment-moderation.php
r3438581 r3807202 4 4 5 5 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 6 7 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 } 6 11 7 12 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 86 91 ); 87 92 88 return $comments > 0; // @phpstan-ignore-line93 return $comments > 0; 89 94 } 90 95 -
yoast-comment-hacks/tags/2.1.8/inc/progress-planner/comment-policy.php
r3438581 r3807202 5 5 use EmiliaProjects\WP\Comment\Inc\Hacks; 6 6 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 7 12 8 13 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 79 84 */ 80 85 public function should_add_task() { 81 if ( ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy'] ) { 82 return true; 83 } 84 85 return false; 86 return ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy']; 86 87 } 87 88 -
yoast-comment-hacks/tags/2.1.8/inc/progress-planner/comment-redirect.php
r3438581 r3807202 5 5 use EmiliaProjects\WP\Comment\Inc\Hacks; 6 6 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 7 12 8 13 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 78 83 */ 79 84 public function should_add_task() { 80 if ( ! $this->options['redirect_page'] ) { 81 return true; 82 } 83 84 return false; 85 return ! $this->options['redirect_page']; 85 86 } 86 87 -
yoast-comment-hacks/tags/2.1.8/readme.md
r3438581 r3807202 10 10 [](https://github.com/ProgressPlanner/comment-hacks/actions/workflows/test.yml) 11 11 12  13 12 14 # Comment Experience 13 15 14 Improve the comment experience on your site. Adds lots of features to make commenting easier and more engaging.16 Make WordPress comments easier to manage with cleaner moderation emails, better routing, comment policy controls, length limits, and tools for following up with commenters. 15 17 16 ## Description18 ## Why this plugin exists 17 19 18 This plugin adds many small improvements around core WordPress comments to make them more bearable: 20 Core WordPress comments work, but moderation and follow-up can feel clunky. Comment Experience adds practical improvements for site owners and editors who want a cleaner, more manageable comment workflow without replacing the native comments system. 19 21 20 * Cleaner comment notification emails. 21 * The option to enforce a comment policy. 22 * The option to forward comments to an email address (for instance for your support team) and then trash them. 23 * The option to disallow comments below a certain length. 24 * The option to redirect first time commenters to a "thank you" page. 25 * An input field on the comment edit screen to change the comment parent ID. 26 * Links in the admin comments section to email individual commenters. 27 * A button in the WP toolbar to email all the commenters on a post. 22 ## What it helps you do 23 24 - Clean up comment notification emails so moderation is easier. 25 - Require acceptance of a comment policy before submission. 26 - Forward comments to another email address and optionally trash them. 27 - Set minimum and maximum comment lengths. 28 - Redirect first-time commenters to a thank-you page. 29 - Change a comment's parent ID from the comment edit screen. 30 - Email an individual commenter from the comments screen. 31 - Email all commenters on a post from the admin bar. 32 - Route comment emails to another user from a post's discussion settings. 33 34 ## Installation 35 36 ### From WordPress admin 37 38 1. In your WordPress dashboard, go to **Plugins → Add New**. 39 2. Search for **Comment Experience** or **comment hacks**. 40 3. Install and activate the plugin. 41 4. Go to **Settings → Comment Experience** to configure the available options. 42 43 ### Manual installation 44 45 1. Download the plugin zip. 46 2. Upload the `comment-hacks` folder to `/wp-content/plugins/`. 47 3. Activate the plugin in **Plugins**. 48 4. Go to **Settings → Comment Experience** to configure the available options. 28 49 29 50 ## Screenshots 30 51 31 Screenshot of a clean comment notification email:<br> 32 <br> 33 <br> 34 The comment parent edit box:<br> 35 <br> 36 <br> 37 The plugins admin settings:<br> 38 <br> 39 <br> 40 The button on the frontend to email all the commenters on a post:<br> 41 <br> 42 <br> 43 The link in the backend to email an individual commenters on a post:<br> 44 <br><br> 52 ### Cleaner comment notification emails 53  54 55 ### Edit a comment's parent directly from the comment screen 56  57 58 ### Configure comment length, policy, redirects, email links, and forwarding from one settings screen 59  60 61 ### Email all commenters on a post from the WordPress admin bar 62  63 64 ### Contact an individual commenter from the comments list table 65  66 67 ## Support, issues, and security 68 69 - Questions or support: [WordPress.org support forum](https://wordpress.org/support/plugin/yoast-comment-hacks/) 70 - Bug reports and feature requests: [GitHub issues](https://github.com/ProgressPlanner/comment-hacks/issues) 71 - Security reports: [Patchstack VDP](https://patchstack.com/database/vdp/comment-hacks) 72 73 ## Contributing 74 75 Contributions are welcome. Please read [`.github/CONTRIBUTING.md`](.github/CONTRIBUTING.md) before opening an issue or pull request. 76 77 ## Links 78 79 - [Plugin page on WordPress.org](https://wordpress.org/plugins/yoast-comment-hacks/) 80 - [Progress Planner](https://progressplanner.com/) -
yoast-comment-hacks/tags/2.1.8/readme.txt
r3438581 r3807202 1 1 === Comment Experience === 2 Contributors: joostdevalk 3 Tags: comments, spam, emails 4 Text Domain: comment-hacks 5 Requires at least: 6.6 6 Tested up to: 6.8 7 Stable tag: 2.1.7 2 Contributors: joostdevalk, aristath, filipi, progressplanner 3 Tags: comments, comment moderation, comment emails, discussion, comment policy 4 Text Domain: yoast-comment-hacks 5 Stable tag: 2.1.8 8 6 Requires at least: 6.7 9 Tested up to: 6.97 Tested up to: 7.1 10 8 Requires PHP: 7.4 11 Stable tag: 2.1.6 12 License: GPLv3 9 License: GPL-3.0-or-later 13 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 14 Requires PHP: 7.4 15 16 Make comments management easier by applying the simple hacks Joost has gathered over the years. 11 12 Improve WordPress comment moderation with cleaner emails, comment policy checks, routing, redirects, and length controls. 17 13 18 14 == Description == 19 15 20 Make comments management easier by applying the simple hacks Joost has gathered over the years. 21 22 This plugin adds some small hacks around core WordPress comments to make them more bearable: 23 24 * Cleaner comment notification emails. 25 * The option to enforce a comment policy: just create a comment policy page, toggle the option on and select it, and 26 commenters will have to accept your comment policy before being able to comment. 27 * The option to forward comments to an email address (for instance for your support team) and then trash them. 28 * The option to disallow comments below and above a certain length. 29 * The option to redirect first time commenters to a "thank you" page. 30 * An input field on the comment edit screen to change the comment parent ID. 31 * Links in the admin comments section to email individual commenters. 32 * A button in the WP toolbar to email all the commenters on a post. 33 * Adds a comment routing option. This adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 34 35 See the screenshots to get an even better idea of the plugins' functionality. 36 37 === Have you found an issue? === 38 39 If you have bugs to report, please go to [the plugin's GitHub repository](https://github.com/emilia-capital/comment-hacks). For security issues, please use our [vulnerability disclosure program](https://patchstack.com/database/vdp/comment-hacks), which is managed by PatchStack. They will assist you with verification, CVE assignment, and, of course, notify us. 40 16 Comment Experience helps you manage WordPress comments more efficiently without replacing the native comments system. 17 18 If you moderate comments regularly, this plugin gives you practical improvements that make follow-up easier, keep discussions clearer, and reduce repetitive admin work. 19 20 = Features that improve comment moderation = 21 22 * Clean up comment notification emails so important details are easier to scan. 23 * Require commenters to accept a comment policy before submitting. 24 * Forward comments to another email address and optionally trash them after forwarding. 25 * Set minimum and maximum comment lengths. 26 * Redirect first-time commenters to a thank-you page. 27 * Change a comment's parent ID from the comment edit screen. 28 * Email an individual commenter directly from the comments list. 29 * Email all commenters on a post from the WordPress admin bar. 30 * Route comment emails to another user from a post's discussion settings. 31 32 = Who this plugin is for = 33 34 Comment Experience is useful for site owners, editors, community managers, and support teams who rely on WordPress comments and want a smoother moderation workflow. 35 36 = Need help or want to report something? = 37 38 For support, visit the [WordPress.org support forum](https://wordpress.org/support/plugin/yoast-comment-hacks/). 39 40 For bugs or feature requests, use the [GitHub repository](https://github.com/ProgressPlanner/comment-hacks). 41 42 For security issues, please use our [vulnerability disclosure program](https://patchstack.com/database/vdp/comment-hacks), managed by Patchstack. 41 43 42 44 == Installation == 43 45 44 **Install through your backend** 45 46 1. Search for "comment hacks", click install. 47 1. You're done. 48 49 **Install manually** 46 = Install from your WordPress dashboard = 47 48 1. Go to **Plugins > Add New Plugin**. 49 2. Search for **Comment Experience** or **comment hacks**. 50 3. Click **Install Now** and then **Activate**. 51 4. Go to **Settings > Comment Experience** to configure the plugin. 52 53 = Install manually = 50 54 51 55 1. Download and unzip the plugin. 52 1. Upload the `comment-hacks` directory to the `/wp-content/plugins/` directory. 53 1. Activate the plugin through the 'Plugins' menu in WordPress. 54 1. Configure your settings on the Settings → Comment Experience screen. 56 2. Upload the `comment-hacks` directory to the `/wp-content/plugins/` directory. 57 3. Activate the plugin through the **Plugins** menu in WordPress. 58 4. Go to **Settings > Comment Experience** to configure the plugin. 59 60 == Frequently Asked Questions == 61 62 = What does Comment Experience do? = 63 64 Comment Experience improves WordPress comment moderation with cleaner notification emails, comment policy options, comment routing, redirects, and comment length controls. 65 66 = Does it replace the default WordPress comments system? = 67 68 No. It enhances core WordPress comments with extra moderation and workflow features. 69 70 = Can I require visitors to accept a comment policy? = 71 72 Yes. You can create a comment policy page, enable the option, and require acceptance before a comment can be submitted. 73 74 = Can I limit how short or long comments can be? = 75 76 Yes. The plugin lets you configure both minimum and maximum comment length limits. 77 78 = Can I send comment notifications to someone else? = 79 80 Yes. You can forward comments to another email address, and you can also route comment emails to another user from a post's discussion settings. 55 81 56 82 == Screenshots == 57 83 58 1. Screenshot of a clean comment notification email.59 2. The comment parent edit box.60 3. The plugins admin settings.61 4. The button on the frontend to email all thecommenters on a post.62 5. The link in the backend to email an individual commenters on a post.84 1. Cleaner WordPress comment notification email that is easier to scan while moderating. 85 2. Comment parent field on the comment edit screen for fixing comment thread hierarchy. 86 3. Comment Experience settings for comment length limits, comment policy, email links, redirects, clean emails, and forwarding. 87 4. Admin bar button for emailing all commenters on a post. 88 5. Comments list action link for emailing an individual commenter. 63 89 64 90 == Changelog == 65 91 92 = 2.1.8 = 93 * Security: strengthen permission checks for comment actions and notification recipients. 94 * Security: escape comment content in notification emails and restrict user searches to public names. 95 * Apply comment length limits and comment policy acceptance to REST API comment creation. 96 * Replace the notification recipient dropdown with an AJAX-powered user search. 97 * Fix first-time commenter redirects, cached option values, and email formatting for older comments. 98 * Preserve the ability to remove a comment's parent by clearing the parent field. 99 * Update compatibility information for WordPress 7.1. 100 66 101 = 2.1.7 = 67 68 * Minor updates, name change mostly. 102 * Maintenance release with minor updates and the Comment Experience name change. 69 103 70 104 = 2.1.6 = 71 72 * Compatibility with Progress Planner v1.9 105 * Compatibility with Progress Planner v1.9. 73 106 74 107 = 2.1.5 = 75 76 * Compatibility with Progress Planner v1.8 108 * Compatibility with Progress Planner v1.8. 77 109 78 110 = 2.1.4 = 79 80 111 * Add compatibility with WordPress 6.8. 81 112 * Save proper values for Redirect page settings when no selection is made. 82 * Run upgrade routine only when plugin version is increased83 * Migrate PHPUnit XML schema 84 * Compatibility with Progress Planner v1.4 113 * Run the upgrade routine only when the plugin version increases. 114 * Migrate PHPUnit XML schema. 115 * Compatibility with Progress Planner v1.4. 85 116 86 117 = 2.1.3 = 87 88 * Add necessary compatibility to Progress Planner integration for the upcoming WordPress 6.8. 118 * Add compatibility for the upcoming WordPress 6.8 release in Progress Planner integration. 89 119 90 120 = 2.1.2 = 91 92 121 * Rename the plugin from "Comment Hacks" to "Comment Experience". 93 * Bring up to date with changes in Progress Planner122 * Bring the plugin up to date with changes in Progress Planner. 94 123 95 124 = 2.1.1 = 96 97 125 * Don't enqueue the remove URL script on the frontend for logged out users or users without the `edit_posts` capability. 98 126 99 127 = 2.1 = 100 101 * Added a link to remove the author's URL from the comment from the frontend. 102 * Fix comment policy function for admins and editors. 128 * Add a link to remove the author's URL from the comment from the frontend. 129 * Fix the comment policy function for admins and editors. 103 130 104 131 = 1.9.4 = 105 106 132 * Fix fatal due to wrong class import, props [@andizer](https://profiles.wordpress.org/andizer/). 107 133 108 134 = 1.9.3 = 109 110 * Fix bug where comment reroute recipient would not save. 111 * Added an option to disable the "Email all commenters" admin bar button. 135 * Fix bug where the comment reroute recipient would not save. 136 * Add an option to disable the "Email all commenters" admin bar button. 112 137 113 138 = 1.9.2 = 114 115 139 * Fix missing autoloader. 116 140 117 141 = 1.9 = 118 119 * Introduces a new option to the plugin: adding a comment policy was never easier than this: just create a comment 120 policy page, toggle the option on and select it, and commenters will have to accept your comment policy before being 121 able to comment. 122 * Fixes a bug where editing a comment on the quick edit screen would cause that comment to lose its parent. 123 * Enhances performance by preventing too frequent option updates. 124 * Remove all direct DB queries in favor of using WordPress core functions. 142 * Add a comment policy option so commenters must accept your policy before commenting. 143 * Fix a bug where editing a comment on the quick edit screen would cause that comment to lose its parent. 144 * Improve performance by preventing too frequent option updates. 145 * Remove all direct database queries in favor of WordPress core functions. 125 146 126 147 = 1.8.1 = 127 128 * Fixed a couple of PHP 7.4 related issues. 148 * Fix a couple of PHP 7.4 related issues. 129 149 130 150 = 1.8 = 131 132 * Changed namespace to `JoostBlog`. 133 * Removed Yoast branding. 134 * Updated plugin to require PHP 7.4. 151 * Change namespace to `JoostBlog`. 152 * Remove Yoast branding. 153 * Update the plugin to require PHP 7.4. 135 154 136 155 = 1.7 = 137 138 * Bugfixes: 139 * Fixed: the "Email commenters" link would not be displayed in the WordPress admin bar and in the Comments list. 140 * Fixed: the "Email commenters" link in the front end admin bar wouldn't work when jQuery wasn't enqueued. 141 * Fixed: the notification emails for new comments would have incorrect content for the Author line and the text displayed before the comment. 156 * Fix the "Email commenters" link not displaying in the WordPress admin bar and comments list. 157 * Fix the frontend admin bar email commenters link when jQuery was not enqueued. 158 * Fix incorrect author line and comment intro text in notification emails. 142 159 143 160 = 1.6 = 144 145 161 * Fix language packs. 146 162 147 163 = 1.5 = 148 149 * Bugfixes: 150 * Fixed: comment recipient dropdown would reset on reload of the page. 151 * Fixed: admin bar CSS showing when no admin bar is showing. 164 * Fix the comment recipient dropdown resetting on page reload. 165 * Fix admin bar CSS showing when the admin bar is not visible. 152 166 153 167 = 1.4 = 154 155 * Enhancements: 156 * Limit the roles shown in the comment notifications dropdown to roles that normally exist and can write. Introduces a new filter to allow expanding them. 168 * Limit the roles shown in the comment notifications dropdown to roles that normally exist and can write. 169 * Introduce a new filter to allow expanding those roles. 157 170 158 171 = 1.3 = 159 160 * Enhancements: 161 * Add option to restrict comments that are too long, next to too small. 162 * Add `reply-to` header to comment notification and moderation emails, pointing to the post author. 163 * Preserve the active tab when saving settings. 164 * Remove `[...]` from pingback / trackback excerpt in cleaned emails as that's already included by core. 165 * Replace link to ARIN with link to [ip-lookup.net](http://ip-lookup.net) for details about the IP. 166 * Refactored code for readability and code quality. 167 * Refactor upgrade routine to do less DB queries. 172 * Add an option to restrict comments that are too long, next to comments that are too short. 173 * Add a `reply-to` header to comment notification and moderation emails that points to the post author. 174 * Preserve the active tab when saving settings. 175 * Remove `[...]` from pingback and trackback excerpts in cleaned emails because core already includes it. 176 * Replace the ARIN link with [ip-lookup.net](http://ip-lookup.net) for IP details. 177 * Refactor code for readability and code quality. 178 * Refactor the upgrade routine to do fewer database queries. 168 179 169 180 = 1.2 = 170 171 Fixes several issues: 172 173 * Differentiate between AJAX request and normal POST for nonce checking, fixes #7. 174 * Make sure comment type isn't empty in cleaned email, fixes #8. 175 * Allow setting the comment parent to 0, fixes #10. 176 * Prevents defaults from being reinstated, fixes #14. 177 178 Also: 179 180 * Adds translator comments to all strings with `sprintf` / `printf`. 181 * Updates to new version of Yoast i18n, in the process switching from `translate.yoast.com` to `translate.wordpress.org` and removing packaged translations. 182 * Added `yarn.lock` and removed no longer needed i18n grunt tasks. 181 * Differentiate between AJAX requests and normal POST requests for nonce checking, fixing #7. 182 * Make sure the comment type is not empty in cleaned emails, fixing #8. 183 * Allow setting the comment parent to 0, fixing #10. 184 * Prevent defaults from being reinstated, fixing #14. 185 * Add translator comments to all strings with `sprintf` / `printf`. 186 * Update to a new version of Yoast i18n, switching from `translate.yoast.com` to `translate.wordpress.org` and removing packaged translations. 187 * Add `yarn.lock` and remove no longer needed i18n grunt tasks. 183 188 184 189 = 1.1.1 = 185 186 * Add text domain so the plugin can be translated. 190 * Add a text domain so the plugin can be translated. 187 191 188 192 = 1.1 = 189 190 * Add comment routing option, adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 193 * Add a comment routing option with a dropdown in a post's discussion settings for routing comment emails to another user. 191 194 192 195 = 1.0 = 193 194 196 * Initial version. 197 198 == Upgrade Notice == 199 200 = 2.1.8 = 201 Security and reliability improvements. REST clients must send comment_policy: true or comment_policy: "on" when comment policy acceptance is enabled. 202 203 = 2.1.7 = 204 This maintenance release keeps Comment Experience current and aligned with its updated branding. -
yoast-comment-hacks/trunk/admin/admin.php
r3438581 r3807202 3 3 namespace EmiliaProjects\WP\Comment\Admin; 4 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 9 5 10 use EmiliaProjects\WP\Comment\Inc\Hacks; 11 use EmiliaProjects\WP\Comment\Inc\Notifications; 6 12 use WP_Comment; 7 13 use WP_Post; … … 63 69 64 70 \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_discussion_settings_script' ] ); 71 72 \add_action( 'wp_ajax_ch_search_users', [ $this, 'ajax_search_users' ] ); 65 73 66 74 new Comment_Parent(); … … 135 143 && isset( $_GET['comment_id'] ) 136 144 && $_GET['ch_action'] === 'forward_comment' 137 && \wp_verify_nonce( \wp_strip_all_tags( \wp_unslash( $_GET['nonce'] ) ), 'comment-hacks-forward' )138 145 ) { 139 146 $comment_id = (int) $_GET['comment_id']; 140 $comment = \get_comment( $comment_id ); 147 if ( $comment_id <= 0 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_GET['nonce'] ) ), 'comment-hacks-forward_' . $comment_id ) ) { 148 return; 149 } 150 151 $comment = \get_comment( $comment_id ); 152 if ( ! $comment || ! \current_user_can( 'edit_comment', $comment_id ) ) { 153 return; 154 } 141 155 142 156 echo '<div class="msg updated"><p>'; … … 157 171 158 172 if ( ! empty( $this->options['forward_extra'] ) ) { 159 $intro .= $this->options['forward_extra']. "\n\n";173 $intro .= \esc_html( $this->options['forward_extra'] ) . "\n\n"; 160 174 } 161 175 … … 167 181 $intro .= "\n\n"; 168 182 169 $content = \nl2br( $intro . $comment->comment_content);183 $content = \nl2br( $intro . \esc_html( $comment->comment_content ) ); 170 184 171 185 $headers = [ … … 192 206 */ 193 207 public function forward_to_support_action_link( $actions, $comment ): array { 194 if ( empty( $this->options['forward_email'] ) ) {208 if ( empty( $this->options['forward_email'] ) || ! \current_user_can( 'edit_comment', (int) $comment->comment_ID ) ) { 195 209 return $actions; 196 210 } … … 205 219 } 206 220 207 $actions['ch_forward'] = '<a href="' . \esc_url( \admin_url( 'edit-comments.php' ) . '?comment_id=' . $comment->comment_ID . '&ch_action=forward_comment&nonce=' . \wp_create_nonce( 'comment-hacks-forward ') ) . '">' . \esc_html( $label ) . '</a>';221 $actions['ch_forward'] = '<a href="' . \esc_url( \admin_url( 'edit-comments.php' ) . '?comment_id=' . $comment->comment_ID . '&ch_action=forward_comment&nonce=' . \wp_create_nonce( 'comment-hacks-forward_' . $comment->comment_ID ) ) . '">' . \esc_html( $label ) . '</a>'; 208 222 209 223 return $actions; … … 236 250 */ 237 251 public function meta_box_callback( $post ): void { 252 $selected_id = (int) \get_post_meta( $post->ID, self::NOTIFICATION_RECIPIENT_KEY, true ); 253 $selected_name = ''; 254 255 if ( $selected_id > 0 ) { 256 $user = \get_userdata( $selected_id ); 257 if ( $user ) { 258 $selected_name = $user->display_name; 259 } 260 } 261 238 262 ?> 239 263 <input … … 242 266 value="<?php echo \esc_attr( \wp_create_nonce( 'comment_notification_recipient_nonce' ) ); ?>" 243 267 /> 244 <label for="comment_notification_recipient ">268 <label for="comment_notification_recipient_search"> 245 269 <?php \esc_html_e( 'Comment notification recipients:', 'yoast-comment-hacks' ); ?> 246 270 </label> 247 271 <br/> 272 <input 273 type="hidden" 274 name="comment_notification_recipient" 275 id="comment_notification_recipient" 276 value="<?php echo \esc_attr( (string) $selected_id ); ?>" 277 /> 278 <input 279 type="text" 280 id="comment_notification_recipient_search" 281 value="<?php echo \esc_attr( $selected_name ); ?>" 282 placeholder="<?php \esc_attr_e( 'Search for a user...', 'yoast-comment-hacks' ); ?>" 283 class="widefat" 284 autocomplete="off" 285 /> 286 <ul id="comment_notification_recipient_results" style="display:none;margin:0;padding:0;list-style:none;border:1px solid #ddd;background:#fff;max-height:150px;overflow-y:auto;"></ul> 287 <?php if ( $selected_id > 0 ) : ?> 288 <a href="#" id="comment_notification_recipient_clear" style="display:inline;"> 289 <?php \esc_html_e( 'Reset to post author', 'yoast-comment-hacks' ); ?> 290 </a> 291 <?php else : ?> 292 <a href="#" id="comment_notification_recipient_clear" style="display:none;"> 293 <?php \esc_html_e( 'Reset to post author', 'yoast-comment-hacks' ); ?> 294 </a> 295 <?php endif; ?> 296 <p class="description"><?php \esc_html_e( 'Leave empty to use post author.', 'yoast-comment-hacks' ); ?></p> 248 297 <?php 249 250 /** 251 * This filter allows filtering which roles should be shown in the dropdown for notifications. 252 * Defaults to contributor and up. 253 * 254 * @param array $roles Array with user roles. 255 * 256 * @since 1.6.0 257 */ 258 $roles = \apply_filters( 259 'comment_experience\notification_roles', 260 [ 'contributor', 'author', 'editor', 'administrator', 'super-admin' ] 261 ); 262 263 \wp_dropdown_users( 298 } 299 300 /** 301 * AJAX handler for searching users. 302 * 303 * @return void 304 */ 305 public function ajax_search_users(): void { 306 \check_ajax_referer( 'ch_search_users_nonce', 'nonce' ); 307 308 if ( ! \current_user_can( 'edit_posts' ) ) { 309 \wp_send_json_error( 'Unauthorized' ); 310 } 311 312 $search = isset( $_GET['search'] ) ? \sanitize_text_field( \wp_unslash( $_GET['search'] ) ) : ''; 313 314 if ( \strlen( $search ) < 2 ) { 315 \wp_send_json_success( [] ); 316 } 317 318 $users = \get_users( 264 319 [ 265 'se lected' => \get_post_meta( $post->ID, self::NOTIFICATION_RECIPIENT_KEY, true ),266 's how_option_none' => 'Post author',267 ' name' => 'comment_notification_recipient',268 ' id' => 'comment_notification_recipient',269 ' role__in' => $roles,270 'o ption_none_value' => 0,320 'search' => '*' . $search . '*', 321 'search_columns' => [ 'display_name', 'user_nicename' ], 322 'role__in' => Notifications::get_allowed_roles(), 323 'number' => 20, 324 'orderby' => 'display_name', 325 'order' => 'ASC', 271 326 ] 272 327 ); 328 329 $results = []; 330 foreach ( $users as $user ) { 331 $results[] = [ 332 'id' => $user->ID, 333 'name' => $user->display_name, 334 ]; 335 } 336 337 \wp_send_json_success( $results ); 273 338 } 274 339 … … 293 358 * Enqueue our admin script. 294 359 * 295 * @return void 296 */ 297 public function enqueue(): void { 360 * @param string $hook_suffix The current admin page. 361 * 362 * @return void 363 */ 364 public function enqueue( $hook_suffix ): void { 298 365 $page = \filter_input( \INPUT_GET, 'page' ); 299 366 … … 314 381 ); 315 382 } 383 384 if ( $hook_suffix === 'post.php' || $hook_suffix === 'post-new.php' ) { 385 \wp_enqueue_script( 386 'emiliaprojects-comment-hacks-user-search', 387 \plugins_url( 'admin/assets/js/user-search.js', \EMILIA_COMMENT_HACKS_FILE ), 388 [ 'jquery' ], 389 \EMILIA_COMMENT_HACKS_VERSION, 390 true 391 ); 392 393 \wp_localize_script( 394 'emiliaprojects-comment-hacks-user-search', 395 'chUserSearch', 396 [ 397 'ajax_url' => \admin_url( 'admin-ajax.php' ), 398 'nonce' => \wp_create_nonce( 'ch_search_users_nonce' ), 399 ] 400 ); 401 402 \wp_add_inline_style( 403 'wp-admin', 404 '#comment_notification_recipient_results li { padding: 5px; margin: 0; cursor: pointer; } #comment_notification_recipient_results li:hover { background: #f0f0f1; }' 405 ); 406 } 316 407 } 317 408 … … 325 416 public function save_reroute_comment_emails( $post_id ): void { 326 417 327 if ( ! isset( $_POST['comment_notification_recipient'] ) || ! \wp_verify_nonce( \filter_input( \INPUT_POST, 'comment_notification_recipient_nonce' ), 'comment_notification_recipient_nonce' ) ) { 418 if ( 419 ! isset( $_POST['comment_notification_recipient'], $_POST['comment_notification_recipient_nonce'] ) 420 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_POST['comment_notification_recipient_nonce'] ) ), 'comment_notification_recipient_nonce' ) 421 || ! \current_user_can( 'edit_post', $post_id ) 422 ) { 328 423 return; 329 424 } 330 425 331 $recipient_id = (int) \sanitize_key( \wp_unslash( $_POST['comment_notification_recipient'] ) ); 332 if ( $recipient_id > 0 ) { 426 $recipient_id = \filter_var( \wp_unslash( $_POST['comment_notification_recipient'] ), \FILTER_VALIDATE_INT ); 427 if ( $recipient_id === 0 ) { 428 \delete_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY ); 429 } 430 elseif ( $recipient_id > 0 && Notifications::is_allowed_recipient( $recipient_id ) ) { 333 431 \update_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY, $recipient_id ); 334 432 } … … 402 500 */ 403 501 private function sanitize_bool( $value ): bool { 404 return ( $value || ! empty( $value ) );502 return (bool) $value; 405 503 } 406 504 … … 478 576 '<code style="background-color: #eee; margin: 0; padding: 0;">', 479 577 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- This is only shown in debug mode. 480 \highlight_string( "<?php\n\$this->options = " . \var_export( $this->options, true ) . ';', true ), 481 $num 578 \highlight_string( "<?php\n\$this->options = " . \var_export( $this->options, true ) . ';', true ) 482 579 ); 483 580 ?> -
yoast-comment-hacks/trunk/admin/comment-parent.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Admin; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 34 39 */ 35 40 public function load_comment_parent_box() { 36 if ( \function_exists( 'add_meta_box' ) ) { 37 \add_meta_box( 38 'comment_parent', 39 \esc_html__( 'Comment Parent', 'yoast-comment-hacks' ), 40 [ 41 $this, 42 'comment_parent_box', 43 ], 44 'comment', 45 'normal' 46 ); 47 } 41 \add_meta_box( 42 'comment_parent', 43 \esc_html__( 'Comment Parent', 'yoast-comment-hacks' ), 44 [ 45 $this, 46 'comment_parent_box', 47 ], 48 'comment', 49 'normal' 50 ); 48 51 } 49 52 … … 51 54 * Updates the comment parent field. 52 55 * 56 * @param int $comment_id The comment ID supplied by the edit_comment hook. 57 * 53 58 * @return void 54 59 */ 55 public function update_comment_parent() { 56 $comment_parent = \filter_input( \INPUT_POST, 'epch_comment_parent', \FILTER_VALIDATE_INT ); 57 $comment_id = \filter_input( \INPUT_POST, 'comment_ID', \FILTER_VALIDATE_INT ); 58 $action = \filter_input( \INPUT_POST, 'action' ); 59 60 if ( $action === 'edit-comment' ) { 61 return; // We're on the quick edit screen. As the comment parent isn't sent along here, we might lose it if we do anything. 60 public function update_comment_parent( $comment_id ) { 61 if ( 62 ! \is_admin() || \wp_doing_ajax() 63 || ! isset( $_POST['action'], $_POST['comment_ID'], $_POST['epch_comment_parent'], $_POST['_wpnonce'] ) 64 || $_POST['action'] !== 'editedcomment' 65 || (int) $_POST['comment_ID'] !== (int) $comment_id 66 || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_POST['_wpnonce'] ) ), 'update-comment_' . $comment_id ) 67 || ! \current_user_can( 'edit_comment', $comment_id ) 68 ) { 69 return; 62 70 } 63 71 64 if ( empty( $comment_id ) && empty( $comment_parent) ) {65 return; // There might be another reason for a comment to be updated.72 if ( ! \is_string( $_POST['epch_comment_parent'] ) ) { 73 return; 66 74 } 67 75 68 if ( \function_exists( 'wp_doing_ajax' ) && \wp_doing_ajax() ) { 69 \check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 76 // An emptied field means "no parent", as it did before this field was validated. 77 $raw_parent = \sanitize_text_field( \wp_unslash( $_POST['epch_comment_parent'] ) ); 78 $comment_parent = ( $raw_parent === '' ) ? 0 : \filter_var( $raw_parent, \FILTER_VALIDATE_INT ); 79 $comment = \get_comment( $comment_id ); 80 if ( $comment_parent === false || $comment_parent < 0 || ! $comment || $comment_parent === (int) $comment_id ) { 81 return; 70 82 } 71 83 72 if ( ! \function_exists( 'wp_doing_ajax' ) || ! \wp_doing_ajax() ) { 73 \check_admin_referer( 'update-comment_' . $comment_id ); 84 // Reject missing parents, parents on other posts, and circular threads. 85 $ancestor_id = $comment_parent; 86 $seen = [ (int) $comment_id ]; 87 while ( $ancestor_id > 0 ) { 88 $parent = \get_comment( $ancestor_id ); 89 if ( ! $parent || (int) $parent->comment_post_ID !== (int) $comment->comment_post_ID || \in_array( $ancestor_id, $seen, true ) ) { 90 return; 91 } 92 $seen[] = $ancestor_id; 93 $ancestor_id = (int) $parent->comment_parent; 74 94 } 75 95 76 if ( ! isset( $comment_parent ) ) { 77 $comment_parent = 0; 78 } 79 80 if ( $comment_id ) { 81 $comment = \get_comment( $comment_id ); 82 $comment->comment_parent = $comment_parent; 83 84 // Remove our filter, or we'll keep looping. 85 \remove_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 86 \wp_update_comment( (array) $comment ); 87 88 // Add our filter back. 89 \add_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 90 } 96 // Remove our filter, or we'll keep looping. 97 \remove_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 98 \wp_update_comment( 99 [ 100 'comment_ID' => $comment_id, 101 'comment_parent' => $comment_parent, 102 ] 103 ); 104 \add_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 91 105 } 92 106 } -
yoast-comment-hacks/trunk/admin/views/comment-parent-box.php
r3438581 r3807202 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 2 7 /** 3 8 * Parent Box view. -
yoast-comment-hacks/trunk/admin/views/config-page.php
r3438581 r3807202 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 7 // phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName 8 2 9 /** 3 10 * Config page admin view. 4 11 * 5 * @var Admin $this12 * @var \EmiliaProjects\WP\Comment\Admin\Admin $this 6 13 */ 7 14 8 use EmiliaProjects\WP\Comment\Admin\Admin;9 15 use EmiliaProjects\WP\Comment\Inc\Hacks; 10 16 -
yoast-comment-hacks/trunk/comment-hacks.php
r3438581 r3807202 5 5 * @wordpress-plugin 6 6 * Plugin Name: Comment Experience 7 * Version: 2.1. 77 * Version: 2.1.8 8 8 * Plugin URI: https://progressplanner.com/plugins/comment-experience/ 9 9 * Description: Improve the comment experience on your site. Adds lots of features to make commenting easier and more engaging. … … 31 31 */ 32 32 33 if ( ! defined( 'ABSPATH' ) ) { 34 exit; 35 } 36 33 37 use EmiliaProjects\WP\Comment\Inc\Autoload; 34 38 use EmiliaProjects\WP\Comment\Inc\Hacks; … … 37 41 * Used for version checks. 38 42 */ 39 define( 'EMILIA_COMMENT_HACKS_VERSION', '2.1. 6' );43 define( 'EMILIA_COMMENT_HACKS_VERSION', '2.1.8' ); 40 44 41 45 /** -
yoast-comment-hacks/trunk/inc/autoload.php
r3265034 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** -
yoast-comment-hacks/trunk/inc/clean-emails.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use WP_Comment; … … 10 15 */ 11 16 class Clean_Emails { 12 13 /**14 * Holds the current comment's ID.15 */16 private int $comment_id = 0;17 17 18 18 /** … … 148 148 $this->comment_moderation_actions(); 149 149 $this->message .= ' | ' . \sprintf( 150 '<a href=" http://ip-lookup.net/index.php?ip=%1$s">%2$s</a>',151 $this->comment->comment_author_IP,150 '<a href="%1$s">%2$s</a>', 151 \esc_url( 'https://ip-lookup.net/index.php?ip=' . \rawurlencode( $this->comment->comment_author_IP ) ), 152 152 \esc_html__( 'Whois', 'yoast-comment-hacks' ) 153 153 ); … … 177 177 */ 178 178 private function add_author_line(): void { 179 if ( $this->comment->comment_type === 'comment' ) {179 if ( $this->comment->comment_type !== 'pingback' && $this->comment->comment_type !== 'trackback' ) { 180 180 /* translators: %1$s is replaced with the comment author's name, %2$s is replaced with the comment author's email */ 181 181 $this->message .= \sprintf( \esc_html__( 'Author: %1$s (%2$s)', 'yoast-comment-hacks' ), \esc_html( $this->comment->comment_author ), '<a href="' . \esc_url( 'mailto:' . $this->comment->comment_author_email ) . '">' . \esc_html( $this->comment->comment_author_email ) . '</a>' ) . '<br />'; … … 193 193 */ 194 194 private function add_content_line(): void { 195 if ( $this->comment->comment_type === 'comment' ) {195 if ( $this->comment->comment_type !== 'pingback' && $this->comment->comment_type !== 'trackback' ) { 196 196 $this->message .= \esc_html__( 'Comment:', 'yoast-comment-hacks' ); 197 197 } … … 200 200 } 201 201 202 $this->message .= '<br />' . \wpautop( $this->comment->comment_content) . '<br />';202 $this->message .= '<br />' . \wpautop( \esc_html( $this->comment->comment_content ) ) . '<br />'; 203 203 } 204 204 … … 232 232 */ 233 233 private function setup_data( int $comment_id ): void { 234 $this->comment_id = $comment_id; 235 $this->comment = \get_comment( $this->comment_id ); 236 $this->post = \get_post( (int) $this->comment->comment_post_ID ); 234 $this->comment = \get_comment( $comment_id ); 235 $this->post = \get_post( (int) $this->comment->comment_post_ID ); 237 236 } 238 237 … … 300 299 */ 301 300 private function comment_action_links( array $actions ): void { 302 $links = '';301 $links = []; 303 302 foreach ( $actions as $action => $label ) { 304 $links .= $this->comment_action_link( $label, $action ) . ' | '; 305 } 306 307 $links = \rtrim( $links, '| ' ); 308 309 $this->message .= $links; 303 $links[] = $this->comment_action_link( $label, $action ); 304 } 305 306 $this->message .= \implode( ' | ', $links ); 310 307 } 311 308 … … 319 316 */ 320 317 private function comment_action_link( string $label, string $action ): string { 321 $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment _id) );318 $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment->comment_ID ) ); 322 319 323 320 return '<a href="' . \esc_url( $url ) . '">' . \esc_html( $label ) . '</a>'; -
yoast-comment-hacks/trunk/inc/email-links.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 46 51 */ 47 52 public function admin_bar_comment_link(): void { 48 if ( ! \ is_singular() || $this->options['disable_email_all_commenters'] ) {53 if ( ! \current_user_can( 'moderate_comments' ) || ! \is_singular() || $this->options['disable_email_all_commenters'] ) { 49 54 return; 50 55 } -
yoast-comment-hacks/trunk/inc/forms.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 use WP_Error; 6 use WP_REST_Request; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 4 12 5 13 /** … … 31 39 public function init() { 32 40 $this->options = Hacks::get_options(); 33 Hacks::get_defaults();34 41 35 42 if ( $this->options['comment_policy'] ) { 36 43 \add_action( 'comment_form_after_fields', [ $this, 'comment_form_fields' ] ); 44 \add_action( 'comment_form_logged_in_after', [ $this, 'comment_form_fields' ] ); 37 45 \add_filter( 'preprocess_comment', [ $this, 'check_comment_policy' ] ); 46 \add_filter( 'rest_pre_insert_comment', [ $this, 'check_rest_comment_policy' ], 10, 2 ); 38 47 } 39 48 } … … 72 81 return $comment_data; 73 82 } 83 84 /** 85 * Require explicit policy acceptance for new REST comments. 86 * 87 * @param array<string, string|int>|WP_Error $comment_data Prepared comment data. 88 * @param WP_REST_Request $request The REST request. 89 * 90 * @return array<string, string|int>|WP_Error 91 */ 92 public function check_rest_comment_policy( $comment_data, WP_REST_Request $request ) { 93 if ( \is_wp_error( $comment_data ) || \current_user_can( 'moderate_comments' ) ) { 94 return $comment_data; 95 } 96 97 $accepted = $request->get_param( 'comment_policy' ); 98 if ( $accepted !== 'on' && $accepted !== true ) { 99 return new WP_Error( 'comment_experience_policy', $this->options['comment_policy_error'], [ 'status' => 400 ] ); 100 } 101 102 return $comment_data; 103 } 74 104 } -
yoast-comment-hacks/trunk/inc/hacks.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use EmiliaProjects\WP\Comment\Admin\Admin; … … 161 166 $comment = \get_comment( $comment_id ); 162 167 163 if ( isset( $comment ) &&$comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) {168 if ( $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) { 164 169 return \sprintf( 165 170 '<a href="#" class="comment-remove-url" data-comment-id="%d" aria-label="%s">%s</a>', … … 251 256 } 252 257 } 253 254 258 // Only change $url when the page option is actually set and not zero. 255 if ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) {259 elseif ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { 256 260 $url = \get_permalink( (int) $this->options['redirect_repeat_page'] ); 257 261 … … 283 287 private function get_option_from_cache( string $option ) { 284 288 $options = \wp_load_alloptions(); 285 return isset( $options[ $option ] ) ? $option : false;289 return isset( $options[ $option ] ) ? $options[ $option ] : false; 286 290 } 287 291 -
yoast-comment-hacks/trunk/inc/length.php
r3438581 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 use WP_Error; 6 7 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 } 4 11 5 12 /** … … 23 30 // Process the comment and check it for length. 24 31 \add_filter( 'preprocess_comment', [ $this, 'check_comment_length' ] ); 32 \add_filter( 'rest_pre_insert_comment', [ $this, 'check_rest_comment_length' ] ); 25 33 26 34 // Add a message to the comment form, before the comment textarea, to inform the user about the allowed comment length. … … 38 46 */ 39 47 public function check_comment_length( $comment_data ): array { 40 // Bail early for editors and admins, they can leave short or long comments if they want. 41 if ( \current_user_can( 'edit_posts' ) ) { 48 $error = $this->get_length_error( $comment_data['comment_content'] ); 49 if ( $error !== '' ) { 50 \wp_die( \esc_html( $error ) . '<br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'yoast-comment-hacks' ) . '</a>' ); 51 } 52 return $comment_data; 53 } 54 55 /** 56 * Apply the same length limits to new REST comments. 57 * 58 * @param array<string, string|int>|WP_Error $comment_data Prepared comment data. 59 * 60 * @return array<string, string|int>|WP_Error 61 */ 62 public function check_rest_comment_length( $comment_data ) { 63 if ( \is_wp_error( $comment_data ) ) { 42 64 return $comment_data; 43 65 } 44 66 45 $length = $this->get_comment_length( $comment_data['comment_content'] ); 67 $error = $this->get_length_error( ( $comment_data['comment_content'] ?? '' ) ); 68 if ( $error !== '' ) { 69 return new WP_Error( 'comment_experience_length', $error, [ 'status' => 400 ] ); 70 } 71 return $comment_data; 72 } 73 74 /** 75 * Get a validation message for a comment's length. 76 * 77 * @param string $content Comment content. 78 * 79 * @return string 80 */ 81 private function get_length_error( string $content ): string { 82 // Preserve the existing exemption for users who can edit posts. 83 if ( \current_user_can( 'edit_posts' ) ) { 84 return ''; 85 } 86 87 $length = $this->get_comment_length( $content ); 46 88 47 89 // Check for comment length and die if too short or too long. 48 $error = false;90 $error = ''; 49 91 if ( $length < $this->options['mincomlength'] ) { 50 92 $error = $this->options['mincomlengtherror']; … … 54 96 } 55 97 56 if ( $error ) { 57 \wp_die( \esc_html( $error ) . '<br /><a href="javascript:history.go(-1);">' . \esc_html__( 'Go back and try again.', 'yoast-comment-hacks' ) . '</a>' ); 58 } 59 return $comment_data; 98 return $error; 60 99 } 61 100 -
yoast-comment-hacks/trunk/inc/notifications.php
r3218529 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 /** … … 19 24 20 25 /** 26 * Get the roles eligible to receive comment notifications. 27 * 28 * @return string[] 29 */ 30 public static function get_allowed_roles(): array { 31 /** 32 * Filter which roles may receive notifications. Defaults to contributor and up. 33 * 34 * @param string[] $roles Array with user roles. 35 * 36 * @since 1.6.0 37 */ 38 return \apply_filters( 39 'comment_experience\notification_roles', 40 [ 'contributor', 'author', 'editor', 'administrator', 'super-admin' ] 41 ); 42 } 43 44 /** 45 * Check recipient eligibility when saving and sending notifications. 46 * 47 * @param int $user_id The proposed recipient. 48 * 49 * @return bool 50 */ 51 public static function is_allowed_recipient( int $user_id ): bool { 52 $user = \get_userdata( $user_id ); 53 54 return $user && $user->user_email !== '' && \array_intersect( $user->roles, self::get_allowed_roles() ) !== []; 55 } 56 57 /** 21 58 * Filter the recipients of the comment notification. 22 59 * … … 28 65 public function filter_notification_recipients( $recipients, $comment_id ): array { 29 66 $comment = \get_comment( $comment_id ); 67 if ( ! $comment ) { 68 return $recipients; 69 } 30 70 31 71 $new_recipient = \get_post_meta( (int) $comment->comment_post_ID, '_comment_notification_recipient', true ); 32 72 33 if ( ! empty( $new_recipient ) ) {73 if ( ! empty( $new_recipient ) && self::is_allowed_recipient( (int) $new_recipient ) ) { 34 74 $user = \get_userdata( $new_recipient ); 35 75 36 return [ $user->user_email ]; 76 if ( $user ) { 77 return [ $user->user_email ]; 78 } 37 79 } 38 80 … … 51 93 $comment = \get_comment( $comment_id ); 52 94 53 if ( $comment->comment_author !== '' && $comment->comment_author_email !== '' ) { 54 $name = \esc_html( $comment->comment_author ); 55 $message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n"; 56 95 if ( $comment->comment_author_email === '' ) { 57 96 return $message_headers; 58 97 } 59 98 60 if ( $comment->comment_author_email !== '' ) { 61 $message_headers .= "\nReply-To: $comment->comment_author_email <$comment->comment_author_email>\n"; 99 $name = ( $comment->comment_author !== '' ) ? \esc_html( $comment->comment_author ) : $comment->comment_author_email; 62 100 63 return $message_headers; 64 } 101 $message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n"; 65 102 66 103 return $message_headers; -
yoast-comment-hacks/trunk/inc/progress-planner-tasks.php
r3290299 r3807202 2 2 3 3 namespace EmiliaProjects\WP\Comment\Inc; 4 5 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; 8 } 4 9 5 10 use Progress_Planner\Suggested_Tasks\Tasks\Providers\Provider; -
yoast-comment-hacks/trunk/inc/progress-planner/comment-moderation.php
r3438581 r3807202 4 4 5 5 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 6 7 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 } 6 11 7 12 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 86 91 ); 87 92 88 return $comments > 0; // @phpstan-ignore-line93 return $comments > 0; 89 94 } 90 95 -
yoast-comment-hacks/trunk/inc/progress-planner/comment-policy.php
r3438581 r3807202 5 5 use EmiliaProjects\WP\Comment\Inc\Hacks; 6 6 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 7 12 8 13 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 79 84 */ 80 85 public function should_add_task() { 81 if ( ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy'] ) { 82 return true; 83 } 84 85 return false; 86 return ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy']; 86 87 } 87 88 -
yoast-comment-hacks/trunk/inc/progress-planner/comment-redirect.php
r3438581 r3807202 5 5 use EmiliaProjects\WP\Comment\Inc\Hacks; 6 6 use Progress_Planner\Suggested_Tasks\Providers\Tasks; 7 8 // phpcs:ignore SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified -- Plugin Check requires defined() without backslash. 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; 11 } 7 12 8 13 if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { … … 78 83 */ 79 84 public function should_add_task() { 80 if ( ! $this->options['redirect_page'] ) { 81 return true; 82 } 83 84 return false; 85 return ! $this->options['redirect_page']; 85 86 } 86 87 -
yoast-comment-hacks/trunk/readme.md
r3438581 r3807202 10 10 [](https://github.com/ProgressPlanner/comment-hacks/actions/workflows/test.yml) 11 11 12  13 12 14 # Comment Experience 13 15 14 Improve the comment experience on your site. Adds lots of features to make commenting easier and more engaging.16 Make WordPress comments easier to manage with cleaner moderation emails, better routing, comment policy controls, length limits, and tools for following up with commenters. 15 17 16 ## Description18 ## Why this plugin exists 17 19 18 This plugin adds many small improvements around core WordPress comments to make them more bearable: 20 Core WordPress comments work, but moderation and follow-up can feel clunky. Comment Experience adds practical improvements for site owners and editors who want a cleaner, more manageable comment workflow without replacing the native comments system. 19 21 20 * Cleaner comment notification emails. 21 * The option to enforce a comment policy. 22 * The option to forward comments to an email address (for instance for your support team) and then trash them. 23 * The option to disallow comments below a certain length. 24 * The option to redirect first time commenters to a "thank you" page. 25 * An input field on the comment edit screen to change the comment parent ID. 26 * Links in the admin comments section to email individual commenters. 27 * A button in the WP toolbar to email all the commenters on a post. 22 ## What it helps you do 23 24 - Clean up comment notification emails so moderation is easier. 25 - Require acceptance of a comment policy before submission. 26 - Forward comments to another email address and optionally trash them. 27 - Set minimum and maximum comment lengths. 28 - Redirect first-time commenters to a thank-you page. 29 - Change a comment's parent ID from the comment edit screen. 30 - Email an individual commenter from the comments screen. 31 - Email all commenters on a post from the admin bar. 32 - Route comment emails to another user from a post's discussion settings. 33 34 ## Installation 35 36 ### From WordPress admin 37 38 1. In your WordPress dashboard, go to **Plugins → Add New**. 39 2. Search for **Comment Experience** or **comment hacks**. 40 3. Install and activate the plugin. 41 4. Go to **Settings → Comment Experience** to configure the available options. 42 43 ### Manual installation 44 45 1. Download the plugin zip. 46 2. Upload the `comment-hacks` folder to `/wp-content/plugins/`. 47 3. Activate the plugin in **Plugins**. 48 4. Go to **Settings → Comment Experience** to configure the available options. 28 49 29 50 ## Screenshots 30 51 31 Screenshot of a clean comment notification email:<br> 32 <br> 33 <br> 34 The comment parent edit box:<br> 35 <br> 36 <br> 37 The plugins admin settings:<br> 38 <br> 39 <br> 40 The button on the frontend to email all the commenters on a post:<br> 41 <br> 42 <br> 43 The link in the backend to email an individual commenters on a post:<br> 44 <br><br> 52 ### Cleaner comment notification emails 53  54 55 ### Edit a comment's parent directly from the comment screen 56  57 58 ### Configure comment length, policy, redirects, email links, and forwarding from one settings screen 59  60 61 ### Email all commenters on a post from the WordPress admin bar 62  63 64 ### Contact an individual commenter from the comments list table 65  66 67 ## Support, issues, and security 68 69 - Questions or support: [WordPress.org support forum](https://wordpress.org/support/plugin/yoast-comment-hacks/) 70 - Bug reports and feature requests: [GitHub issues](https://github.com/ProgressPlanner/comment-hacks/issues) 71 - Security reports: [Patchstack VDP](https://patchstack.com/database/vdp/comment-hacks) 72 73 ## Contributing 74 75 Contributions are welcome. Please read [`.github/CONTRIBUTING.md`](.github/CONTRIBUTING.md) before opening an issue or pull request. 76 77 ## Links 78 79 - [Plugin page on WordPress.org](https://wordpress.org/plugins/yoast-comment-hacks/) 80 - [Progress Planner](https://progressplanner.com/) -
yoast-comment-hacks/trunk/readme.txt
r3438581 r3807202 1 1 === Comment Experience === 2 Contributors: joostdevalk 3 Tags: comments, spam, emails 4 Text Domain: comment-hacks 5 Requires at least: 6.6 6 Tested up to: 6.8 7 Stable tag: 2.1.7 2 Contributors: joostdevalk, aristath, filipi, progressplanner 3 Tags: comments, comment moderation, comment emails, discussion, comment policy 4 Text Domain: yoast-comment-hacks 5 Stable tag: 2.1.8 8 6 Requires at least: 6.7 9 Tested up to: 6.97 Tested up to: 7.1 10 8 Requires PHP: 7.4 11 Stable tag: 2.1.6 12 License: GPLv3 9 License: GPL-3.0-or-later 13 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 14 Requires PHP: 7.4 15 16 Make comments management easier by applying the simple hacks Joost has gathered over the years. 11 12 Improve WordPress comment moderation with cleaner emails, comment policy checks, routing, redirects, and length controls. 17 13 18 14 == Description == 19 15 20 Make comments management easier by applying the simple hacks Joost has gathered over the years. 21 22 This plugin adds some small hacks around core WordPress comments to make them more bearable: 23 24 * Cleaner comment notification emails. 25 * The option to enforce a comment policy: just create a comment policy page, toggle the option on and select it, and 26 commenters will have to accept your comment policy before being able to comment. 27 * The option to forward comments to an email address (for instance for your support team) and then trash them. 28 * The option to disallow comments below and above a certain length. 29 * The option to redirect first time commenters to a "thank you" page. 30 * An input field on the comment edit screen to change the comment parent ID. 31 * Links in the admin comments section to email individual commenters. 32 * A button in the WP toolbar to email all the commenters on a post. 33 * Adds a comment routing option. This adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 34 35 See the screenshots to get an even better idea of the plugins' functionality. 36 37 === Have you found an issue? === 38 39 If you have bugs to report, please go to [the plugin's GitHub repository](https://github.com/emilia-capital/comment-hacks). For security issues, please use our [vulnerability disclosure program](https://patchstack.com/database/vdp/comment-hacks), which is managed by PatchStack. They will assist you with verification, CVE assignment, and, of course, notify us. 40 16 Comment Experience helps you manage WordPress comments more efficiently without replacing the native comments system. 17 18 If you moderate comments regularly, this plugin gives you practical improvements that make follow-up easier, keep discussions clearer, and reduce repetitive admin work. 19 20 = Features that improve comment moderation = 21 22 * Clean up comment notification emails so important details are easier to scan. 23 * Require commenters to accept a comment policy before submitting. 24 * Forward comments to another email address and optionally trash them after forwarding. 25 * Set minimum and maximum comment lengths. 26 * Redirect first-time commenters to a thank-you page. 27 * Change a comment's parent ID from the comment edit screen. 28 * Email an individual commenter directly from the comments list. 29 * Email all commenters on a post from the WordPress admin bar. 30 * Route comment emails to another user from a post's discussion settings. 31 32 = Who this plugin is for = 33 34 Comment Experience is useful for site owners, editors, community managers, and support teams who rely on WordPress comments and want a smoother moderation workflow. 35 36 = Need help or want to report something? = 37 38 For support, visit the [WordPress.org support forum](https://wordpress.org/support/plugin/yoast-comment-hacks/). 39 40 For bugs or feature requests, use the [GitHub repository](https://github.com/ProgressPlanner/comment-hacks). 41 42 For security issues, please use our [vulnerability disclosure program](https://patchstack.com/database/vdp/comment-hacks), managed by Patchstack. 41 43 42 44 == Installation == 43 45 44 **Install through your backend** 45 46 1. Search for "comment hacks", click install. 47 1. You're done. 48 49 **Install manually** 46 = Install from your WordPress dashboard = 47 48 1. Go to **Plugins > Add New Plugin**. 49 2. Search for **Comment Experience** or **comment hacks**. 50 3. Click **Install Now** and then **Activate**. 51 4. Go to **Settings > Comment Experience** to configure the plugin. 52 53 = Install manually = 50 54 51 55 1. Download and unzip the plugin. 52 1. Upload the `comment-hacks` directory to the `/wp-content/plugins/` directory. 53 1. Activate the plugin through the 'Plugins' menu in WordPress. 54 1. Configure your settings on the Settings → Comment Experience screen. 56 2. Upload the `comment-hacks` directory to the `/wp-content/plugins/` directory. 57 3. Activate the plugin through the **Plugins** menu in WordPress. 58 4. Go to **Settings > Comment Experience** to configure the plugin. 59 60 == Frequently Asked Questions == 61 62 = What does Comment Experience do? = 63 64 Comment Experience improves WordPress comment moderation with cleaner notification emails, comment policy options, comment routing, redirects, and comment length controls. 65 66 = Does it replace the default WordPress comments system? = 67 68 No. It enhances core WordPress comments with extra moderation and workflow features. 69 70 = Can I require visitors to accept a comment policy? = 71 72 Yes. You can create a comment policy page, enable the option, and require acceptance before a comment can be submitted. 73 74 = Can I limit how short or long comments can be? = 75 76 Yes. The plugin lets you configure both minimum and maximum comment length limits. 77 78 = Can I send comment notifications to someone else? = 79 80 Yes. You can forward comments to another email address, and you can also route comment emails to another user from a post's discussion settings. 55 81 56 82 == Screenshots == 57 83 58 1. Screenshot of a clean comment notification email.59 2. The comment parent edit box.60 3. The plugins admin settings.61 4. The button on the frontend to email all thecommenters on a post.62 5. The link in the backend to email an individual commenters on a post.84 1. Cleaner WordPress comment notification email that is easier to scan while moderating. 85 2. Comment parent field on the comment edit screen for fixing comment thread hierarchy. 86 3. Comment Experience settings for comment length limits, comment policy, email links, redirects, clean emails, and forwarding. 87 4. Admin bar button for emailing all commenters on a post. 88 5. Comments list action link for emailing an individual commenter. 63 89 64 90 == Changelog == 65 91 92 = 2.1.8 = 93 * Security: strengthen permission checks for comment actions and notification recipients. 94 * Security: escape comment content in notification emails and restrict user searches to public names. 95 * Apply comment length limits and comment policy acceptance to REST API comment creation. 96 * Replace the notification recipient dropdown with an AJAX-powered user search. 97 * Fix first-time commenter redirects, cached option values, and email formatting for older comments. 98 * Preserve the ability to remove a comment's parent by clearing the parent field. 99 * Update compatibility information for WordPress 7.1. 100 66 101 = 2.1.7 = 67 68 * Minor updates, name change mostly. 102 * Maintenance release with minor updates and the Comment Experience name change. 69 103 70 104 = 2.1.6 = 71 72 * Compatibility with Progress Planner v1.9 105 * Compatibility with Progress Planner v1.9. 73 106 74 107 = 2.1.5 = 75 76 * Compatibility with Progress Planner v1.8 108 * Compatibility with Progress Planner v1.8. 77 109 78 110 = 2.1.4 = 79 80 111 * Add compatibility with WordPress 6.8. 81 112 * Save proper values for Redirect page settings when no selection is made. 82 * Run upgrade routine only when plugin version is increased83 * Migrate PHPUnit XML schema 84 * Compatibility with Progress Planner v1.4 113 * Run the upgrade routine only when the plugin version increases. 114 * Migrate PHPUnit XML schema. 115 * Compatibility with Progress Planner v1.4. 85 116 86 117 = 2.1.3 = 87 88 * Add necessary compatibility to Progress Planner integration for the upcoming WordPress 6.8. 118 * Add compatibility for the upcoming WordPress 6.8 release in Progress Planner integration. 89 119 90 120 = 2.1.2 = 91 92 121 * Rename the plugin from "Comment Hacks" to "Comment Experience". 93 * Bring up to date with changes in Progress Planner122 * Bring the plugin up to date with changes in Progress Planner. 94 123 95 124 = 2.1.1 = 96 97 125 * Don't enqueue the remove URL script on the frontend for logged out users or users without the `edit_posts` capability. 98 126 99 127 = 2.1 = 100 101 * Added a link to remove the author's URL from the comment from the frontend. 102 * Fix comment policy function for admins and editors. 128 * Add a link to remove the author's URL from the comment from the frontend. 129 * Fix the comment policy function for admins and editors. 103 130 104 131 = 1.9.4 = 105 106 132 * Fix fatal due to wrong class import, props [@andizer](https://profiles.wordpress.org/andizer/). 107 133 108 134 = 1.9.3 = 109 110 * Fix bug where comment reroute recipient would not save. 111 * Added an option to disable the "Email all commenters" admin bar button. 135 * Fix bug where the comment reroute recipient would not save. 136 * Add an option to disable the "Email all commenters" admin bar button. 112 137 113 138 = 1.9.2 = 114 115 139 * Fix missing autoloader. 116 140 117 141 = 1.9 = 118 119 * Introduces a new option to the plugin: adding a comment policy was never easier than this: just create a comment 120 policy page, toggle the option on and select it, and commenters will have to accept your comment policy before being 121 able to comment. 122 * Fixes a bug where editing a comment on the quick edit screen would cause that comment to lose its parent. 123 * Enhances performance by preventing too frequent option updates. 124 * Remove all direct DB queries in favor of using WordPress core functions. 142 * Add a comment policy option so commenters must accept your policy before commenting. 143 * Fix a bug where editing a comment on the quick edit screen would cause that comment to lose its parent. 144 * Improve performance by preventing too frequent option updates. 145 * Remove all direct database queries in favor of WordPress core functions. 125 146 126 147 = 1.8.1 = 127 128 * Fixed a couple of PHP 7.4 related issues. 148 * Fix a couple of PHP 7.4 related issues. 129 149 130 150 = 1.8 = 131 132 * Changed namespace to `JoostBlog`. 133 * Removed Yoast branding. 134 * Updated plugin to require PHP 7.4. 151 * Change namespace to `JoostBlog`. 152 * Remove Yoast branding. 153 * Update the plugin to require PHP 7.4. 135 154 136 155 = 1.7 = 137 138 * Bugfixes: 139 * Fixed: the "Email commenters" link would not be displayed in the WordPress admin bar and in the Comments list. 140 * Fixed: the "Email commenters" link in the front end admin bar wouldn't work when jQuery wasn't enqueued. 141 * Fixed: the notification emails for new comments would have incorrect content for the Author line and the text displayed before the comment. 156 * Fix the "Email commenters" link not displaying in the WordPress admin bar and comments list. 157 * Fix the frontend admin bar email commenters link when jQuery was not enqueued. 158 * Fix incorrect author line and comment intro text in notification emails. 142 159 143 160 = 1.6 = 144 145 161 * Fix language packs. 146 162 147 163 = 1.5 = 148 149 * Bugfixes: 150 * Fixed: comment recipient dropdown would reset on reload of the page. 151 * Fixed: admin bar CSS showing when no admin bar is showing. 164 * Fix the comment recipient dropdown resetting on page reload. 165 * Fix admin bar CSS showing when the admin bar is not visible. 152 166 153 167 = 1.4 = 154 155 * Enhancements: 156 * Limit the roles shown in the comment notifications dropdown to roles that normally exist and can write. Introduces a new filter to allow expanding them. 168 * Limit the roles shown in the comment notifications dropdown to roles that normally exist and can write. 169 * Introduce a new filter to allow expanding those roles. 157 170 158 171 = 1.3 = 159 160 * Enhancements: 161 * Add option to restrict comments that are too long, next to too small. 162 * Add `reply-to` header to comment notification and moderation emails, pointing to the post author. 163 * Preserve the active tab when saving settings. 164 * Remove `[...]` from pingback / trackback excerpt in cleaned emails as that's already included by core. 165 * Replace link to ARIN with link to [ip-lookup.net](http://ip-lookup.net) for details about the IP. 166 * Refactored code for readability and code quality. 167 * Refactor upgrade routine to do less DB queries. 172 * Add an option to restrict comments that are too long, next to comments that are too short. 173 * Add a `reply-to` header to comment notification and moderation emails that points to the post author. 174 * Preserve the active tab when saving settings. 175 * Remove `[...]` from pingback and trackback excerpts in cleaned emails because core already includes it. 176 * Replace the ARIN link with [ip-lookup.net](http://ip-lookup.net) for IP details. 177 * Refactor code for readability and code quality. 178 * Refactor the upgrade routine to do fewer database queries. 168 179 169 180 = 1.2 = 170 171 Fixes several issues: 172 173 * Differentiate between AJAX request and normal POST for nonce checking, fixes #7. 174 * Make sure comment type isn't empty in cleaned email, fixes #8. 175 * Allow setting the comment parent to 0, fixes #10. 176 * Prevents defaults from being reinstated, fixes #14. 177 178 Also: 179 180 * Adds translator comments to all strings with `sprintf` / `printf`. 181 * Updates to new version of Yoast i18n, in the process switching from `translate.yoast.com` to `translate.wordpress.org` and removing packaged translations. 182 * Added `yarn.lock` and removed no longer needed i18n grunt tasks. 181 * Differentiate between AJAX requests and normal POST requests for nonce checking, fixing #7. 182 * Make sure the comment type is not empty in cleaned emails, fixing #8. 183 * Allow setting the comment parent to 0, fixing #10. 184 * Prevent defaults from being reinstated, fixing #14. 185 * Add translator comments to all strings with `sprintf` / `printf`. 186 * Update to a new version of Yoast i18n, switching from `translate.yoast.com` to `translate.wordpress.org` and removing packaged translations. 187 * Add `yarn.lock` and remove no longer needed i18n grunt tasks. 183 188 184 189 = 1.1.1 = 185 186 * Add text domain so the plugin can be translated. 190 * Add a text domain so the plugin can be translated. 187 191 188 192 = 1.1 = 189 190 * Add comment routing option, adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 193 * Add a comment routing option with a dropdown in a post's discussion settings for routing comment emails to another user. 191 194 192 195 = 1.0 = 193 194 196 * Initial version. 197 198 == Upgrade Notice == 199 200 = 2.1.8 = 201 Security and reliability improvements. REST clients must send comment_policy: true or comment_policy: "on" when comment policy acceptance is enabled. 202 203 = 2.1.7 = 204 This maintenance release keeps Comment Experience current and aligned with its updated branding.
Note:
See TracChangeset
for help on using the changeset viewer.