Changeset 5686
- Timestamp:
- 07/18/2017 12:29:59 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r5685 r5686 47 47 add_action( 'bbp_new_reply', array( $this, 'handle_extra_reply_actions' ), 10, 2 ); 48 48 add_action( 'bbp_edit_reply', array( $this, 'handle_extra_reply_actions' ), 10, 2 ); 49 50 // Update topic replies count if the reply status changes on editing. 51 add_filter( 'bbp_edit_reply_pre_insert', array( $this, 'update_replies_count_on_editing_reply' ), 20 ); 49 52 50 53 // Honor i18n number formatting. … … 419 422 420 423 /** 424 * Update topic replies count if the reply status changes on editing. 425 * 426 * This is neccesary to properly account for the status change as a result of 427 * Akismet check or user flagging rather than an explicit moderator action. 428 * 429 * @param array $data Reply post data. 430 * @return array Filtered reply data. 431 */ 432 public function update_replies_count_on_editing_reply( $data ) { 433 // Bail if the reply is not published. 434 if ( 'publish' !== get_post_status( $data['ID'] ) ) { 435 return $data; 436 } 437 438 // Bail if the new status is not pending or spam. 439 if ( ! in_array( $data['post_status'], array( 'pending', 'spam' ) ) ) { 440 return $data; 441 } 442 443 $topic_id = bbp_get_reply_topic_id( $data['ID'] ); 444 445 bbp_update_topic_last_reply_id( $topic_id ); 446 bbp_update_topic_last_active_id( $topic_id ); 447 bbp_update_topic_last_active_time( $topic_id ); 448 bbp_update_topic_voice_count( $topic_id ); 449 450 bbp_decrease_topic_reply_count( $topic_id ); 451 bbp_increase_topic_reply_count_hidden( $topic_id ); 452 453 return $data; 454 } 455 456 /** 421 457 * Override `bbp_number_format()` to behave like `bbp_number_format_i18n()` under default conditions. 422 458 *
Note: See TracChangeset
for help on using the changeset viewer.