Ticket #2653: 2653.diff
File 2653.diff, 1.9 KB (added by , 11 years ago) |
---|
-
src/includes/topics/functions.php
330 330 331 331 if ( !empty( $topic_id ) && !is_wp_error( $topic_id ) ) { 332 332 333 /** Close Check *******************************************************/ 334 335 // If the topic is closed, close it properly 336 if ( ( get_post_field( 'post_status', $topic_id ) === bbp_get_closed_status_id() ) || ( $topic_data['post_status'] === bbp_get_closed_status_id() ) ) { 337 338 // Close the topic 339 bbp_close_topic( $topic_id ); 340 } 341 333 342 /** Trash Check *******************************************************/ 334 343 335 344 // If the forum is trash, or the topic_status is switched to … … 2708 2717 * 2709 2718 * @param int $topic_id Topic id 2710 2719 * @uses bbp_get_topic() To get the topic 2720 * @uses get_post_meta() To get the topic status meta 2711 2721 * @uses do_action() Calls 'bbp_close_topic' with the topic id 2712 2722 * @uses add_post_meta() To add the previous status to a meta 2713 2723 * @uses wp_update_post() To update the topic with the new status … … 2722 2732 return $topic; 2723 2733 } 2724 2734 2725 // Bail if already closed 2726 if ( bbp_get_closed_status_id() === $topic->post_status ) { 2735 // Get previous topic status meta 2736 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 2737 2738 // Bail if already closed and topic status meta exists 2739 if ( bbp_get_closed_status_id() === $topic->post_status && ! empty( $topic_status ) ) { 2727 2740 return false; 2728 2741 } 2729 2742 2743 // Set status meta public 2744 $topic_status = bbp_get_public_status_id(); 2745 2730 2746 // Execute pre close code 2731 2747 do_action( 'bbp_close_topic', $topic_id ); 2732 2748 2733 2749 // Add pre close status 2734 add_post_meta( $topic_id, '_bbp_status', $topic ->post_status );2750 add_post_meta( $topic_id, '_bbp_status', $topic_status ); 2735 2751 2736 2752 // Set closed status 2737 2753 $topic->post_status = bbp_get_closed_status_id();