Changeset 5610
- Timestamp:
- 06/30/2017 10:27:23 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r5609 r5610 33 33 add_filter( 'login_url', array( $this, 'fix_login_url' ), 10, 3 ); 34 34 35 // Limit no-replies view to certain number of days. 35 // Auto-close topics after a certain number of months since the last reply. 36 add_filter( 'bbp_is_topic_closed', array( $this, 'auto_close_old_topics' ), 10, 2 ); 37 38 // Limit no-replies view to a certain number of days. 36 39 add_filter( 'bbp_register_view_no_replies', array( $this, 'limit_no_replies_view' ) ); 37 40 … … 236 239 237 240 /** 241 * Auto-close topics after 6 months since the last reply. 242 * 243 * @param bool $is_topic_closed Whether the topic is closed. 244 * @return bool True if closed, false if not. 245 */ 246 public function auto_close_old_topics( $is_topic_closed, $topic_id ) { 247 if ( $is_topic_closed ) { 248 return $is_topic_closed; 249 } 250 251 $last_active_post_date = get_post_field( 'post_date', bbp_get_topic_last_active_id( $topic_id ) ); 252 253 if ( ( time() - strtotime( $last_active_post_date ) ) / MONTH_IN_SECONDS >= 6 ) { 254 $is_topic_closed = true; 255 } 256 257 return $is_topic_closed; 258 } 259 260 /** 238 261 * Limits No Replies view to 21 days by default. 239 262 *
Note: See TracChangeset
for help on using the changeset viewer.