IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
36 | 36 | add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 ); |
37 | 37 | |
38 | 38 | add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 ); |
| 39 | add_filter( 'comment_flood_filter', array( $this, 'comment_flood_exemption' ), 100, 3 ); |
39 | 40 | add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 ); |
40 | 41 | |
41 | 42 | // Admin Metaboxes |
… |
… |
|
552 | 553 | $x = new \WP_Ajax_Response(); |
553 | 554 | $x->add( $response ); |
554 | 555 | $x->send(); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Filters the comment flood boolean to exempt plugin admins from throttling. |
| 560 | * |
| 561 | * @param bool $flood_die A true value will result in Slow Down comment warning. |
| 562 | * |
| 563 | * @return bool |
| 564 | */ |
| 565 | public function comment_flood_exemption( $flood_die ) { |
| 566 | |
| 567 | // Return if request is not AJAX or if comment type is anything other than internal-note. |
| 568 | if ( ! defined( 'DOING_AJAX' ) || ! isset( $_REQUEST['comment_type'] ) || $_REQUEST['comment_type'] != 'internal-note' ) { |
| 569 | return $flood_die; |
| 570 | } |
| 571 | |
| 572 | // Check for exempted user roles. |
| 573 | $user = wp_get_current_user(); |
| 574 | |
| 575 | $exempted_roles = array( |
| 576 | 'plugin_admin', |
| 577 | 'plugin_reviewer', |
| 578 | ); |
| 579 | |
| 580 | // Check if any of the exempted roles exist for the current user. |
| 581 | if ( count( array_intersect( $exempted_roles, (array) $user->roles ) ) ) { |
| 582 | |
| 583 | // Return false to override the flood alert. |
| 584 | return false; |
| 585 | } |
| 586 | |
| 587 | return $flood_die; |
555 | 588 | } |
556 | 589 | } |