Changeset 5669
- Timestamp:
- 03/28/2015 07:10:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/functions.php
r5667 r5669 104 104 * @uses bbPress::errors::get_error_codes() To get the {@link WP_Error} errors 105 105 * @uses wp_insert_post() To insert the topic 106 * @uses get_post_field() To get the post status 107 * @uses bbp_get_closed_status_id() To get the closed status id 108 * @uses bbp_close_topic() To close topics 109 * @uses bbp_get_trash_status_id() To get the trash status id 110 * @uses wp_trash_post() To trash topics 111 * @uses bbp_get_spam_status_id() To get the spam status id 112 * @uses add_post_meta() To add spam status meta to spam topics 106 113 * @uses do_action() Calls 'bbp_new_topic' with the topic id, forum id, 107 114 * anonymous data and reply author … … 341 348 if ( ! empty( $topic_id ) && ! is_wp_error( $topic_id ) ) { 342 349 350 /** Close Check *******************************************************/ 351 352 // If the topic is closed, close it properly 353 if ( ( get_post_field( 'post_status', $topic_id ) === bbp_get_closed_status_id() ) || ( $topic_data['post_status'] === bbp_get_closed_status_id() ) ) { 354 355 // Close the topic 356 bbp_close_topic( $topic_id ); 357 } 358 343 359 /** Trash Check *******************************************************/ 344 360 345 361 // If the forum is trash, or the topic_status is switched to 346 // trash, trash itproperly362 // trash, trash the topic properly 347 363 if ( ( get_post_field( 'post_status', $forum_id ) === bbp_get_trash_status_id() ) || ( $topic_data['post_status'] === bbp_get_trash_status_id() ) ) { 348 364 349 // Trash the reply365 // Trash the topic 350 366 wp_trash_post( $topic_id ); 351 367 … … 356 372 /** Spam Check ********************************************************/ 357 373 358 // If reply or topic are spam, officially spam this reply374 // If the topic is spam, officially spam this topic 359 375 if ( $topic_data['post_status'] === bbp_get_spam_status_id() ) { 360 376 add_post_meta( $topic_id, '_bbp_spam_meta_status', bbp_get_public_status_id() ); … … 2746 2762 * @param int $topic_id Topic id 2747 2763 * @uses bbp_get_topic() To get the topic 2764 * @uses get_post_meta() To get the topic status meta 2765 * @uses bbp_get_closed_status_id() to get the closed status 2766 * @uses bbp_get_public_status_id() to get the public status 2748 2767 * @uses do_action() Calls 'bbp_close_topic' with the topic id 2749 2768 * @uses add_post_meta() To add the previous status to a meta … … 2753 2772 * @uses wp_update_post() To update the topic with the new status 2754 2773 * @uses add_post_type_support() To restore topic revisions 2755 * @uses do_action() Calls 'bbp_ opened_topic' with the topic id2774 * @uses do_action() Calls 'bbp_closed_topic' with the topic id 2756 2775 * @return mixed False or {@link WP_Error} on failure, topic id on success 2757 2776 */ … … 2764 2783 } 2765 2784 2766 // Bail if already closed 2767 if ( bbp_get_closed_status_id() === $topic->post_status ) { 2785 // Get previous topic status meta 2786 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 2787 2788 // Bail if already closed and topic status meta exists 2789 if ( bbp_get_closed_status_id() === $topic->post_status && ! empty( $topic_status ) ) { 2768 2790 return false; 2769 2791 } 2792 2793 // Set status meta public 2794 $topic_status = bbp_get_public_status_id(); 2770 2795 2771 2796 // Execute pre close code … … 2773 2798 2774 2799 // Add pre close status 2775 add_post_meta( $topic_id, '_bbp_status', $topic ->post_status );2800 add_post_meta( $topic_id, '_bbp_status', $topic_status ); 2776 2801 2777 2802 // Set closed status
Note: See TracChangeset
for help on using the changeset viewer.