Ticket #6443: 6443.patch
File 6443.patch, 1.5 KB (added by , 2 years ago) |
---|
-
support-forums/inc/class-moderators.php
64 64 add_action( 'bbp_approved_reply', array( $this, 'store_moderator_username' ) ); 65 65 add_action( 'bbp_unapproved_topic', array( $this, 'store_moderator_username' ) ); 66 66 add_action( 'bbp_unapproved_reply', array( $this, 'store_moderator_username' ) ); 67 68 // Clean up after posts are removed from public view 69 add_action( 'bbp_spammed_reply', array( $this, 'fix_pagination_after_remove' ) ); 70 add_action( 'bbp_deleted_reply', array( $this, 'fix_pagination_after_remove' ) ); 71 add_action( 'wporg_bbp_archived_reply', array( $this, 'fix_pagination_after_remove' ) ); 67 72 } 68 73 69 74 /** … … 1064 1069 1065 1070 return $topic_status; 1066 1071 } 1072 1073 /** 1074 * Repaginate a thread after a reply is spammed/deleted/archived. 1075 * 1076 * @param int $reply_id ID of removed reply. 1077 */ 1078 public function fix_pagination_after_remove( $reply_id ) { 1079 if ( $reply_id ) { 1080 if ( $topic_id = bbp_get_reply_topic_id( $reply_id ) ) { 1081 $all_reply_ids_in_thread = bbp_get_all_child_ids( $topic_id, bbp_get_reply_post_type() ); 1082 if ( $all_reply_ids_in_thread ) { 1083 foreach ( $all_reply_ids_in_thread as $_reply_id ) { 1084 $r = bbp_update_reply_position( $_reply_id ); 1085 } 1086 } 1087 } 1088 } 1089 } 1090 1067 1091 }