Changeset 4782
- Timestamp:
- 02/28/2013 02:59:33 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/topics/functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/topics/functions.php
r4778 r4782 297 297 if ( !empty( $topic_id ) && !is_wp_error( $topic_id ) ) { 298 298 299 /** Trash Check *******************************************************/ 300 301 // If the forum is trash, or the topic_status is switched to 302 // trash, trash it properly 303 if ( ( get_post_field( 'post_status', $forum_id ) == bbp_get_trash_status_id() ) || ( $topic_data['post_status'] == bbp_get_trash_status_id() ) ) { 304 305 // Trash the reply 306 wp_trash_post( $topic_id ); 307 308 // Force view=all 309 $view_all = true; 310 } 311 312 /** Spam Check ********************************************************/ 313 314 // If reply or topic are spam, officially spam this reply 315 if ( $topic_data['post_status'] == bbp_get_spam_status_id() ) { 316 add_post_meta( $topic_id, '_bbp_spam_meta_status', bbp_get_public_status_id() ); 317 318 // Force view=all 319 $view_all = true; 320 } 321 322 /** Update counts, etc... *********************************************/ 323 324 do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_author ); 325 299 326 /** Stickies **********************************************************/ 300 327 328 // Sticky check after 'bbp_new_topic' action so forum ID meta is set 301 329 if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) { 302 330 … … 320 348 } 321 349 } 322 323 /** Trash Check *******************************************************/324 325 // If the forum is trash, or the topic_status is switched to326 // trash, trash it properly327 if ( ( get_post_field( 'post_status', $forum_id ) == bbp_get_trash_status_id() ) || ( $topic_data['post_status'] == bbp_get_trash_status_id() ) ) {328 329 // Trash the reply330 wp_trash_post( $topic_id );331 332 // Force view=all333 $view_all = true;334 }335 336 /** Spam Check ********************************************************/337 338 // If reply or topic are spam, officially spam this reply339 if ( $topic_data['post_status'] == bbp_get_spam_status_id() ) {340 add_post_meta( $topic_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );341 342 // Force view=all343 $view_all = true;344 }345 346 /** Update counts, etc... *********************************************/347 348 do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_author );349 350 350 351 /** Additional Actions (After Save) ***********************************/ … … 639 640 } 640 641 641 /** Stickies **************************************************************/642 643 if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {644 645 // What's the dilly?646 switch ( $_POST['bbp_stick_topic'] ) {647 648 // Sticky in forum649 case 'stick' :650 bbp_stick_topic( $topic_id );651 break;652 653 // Sticky in all forums654 case 'super' :655 bbp_stick_topic( $topic_id, true );656 break;657 658 // Normal659 case 'unstick' :660 default :661 bbp_unstick_topic( $topic_id );662 break;663 }664 }665 666 /** Revisions *************************************************************/667 668 // Revision Reason669 if ( !empty( $_POST['bbp_topic_edit_reason'] ) )670 $topic_edit_reason = esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) );671 672 // Update revision log673 if ( !empty( $_POST['bbp_log_topic_edit'] ) && ( 1 == $_POST['bbp_log_topic_edit'] ) ) {674 $revision_id = wp_save_post_revision( $topic_id );675 if ( ! empty( $revision_id ) ) {676 bbp_update_topic_revision_log( array(677 'topic_id' => $topic_id,678 'revision_id' => $revision_id,679 'author_id' => bbp_get_current_user_id(),680 'reason' => $topic_edit_reason681 ) );682 }683 }684 685 642 /** No Errors *************************************************************/ 686 643 … … 689 646 // Update counts, etc... 690 647 do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic_author , true /* Is edit */ ); 648 649 /** Revisions *********************************************************/ 650 651 // Revision Reason 652 if ( !empty( $_POST['bbp_topic_edit_reason'] ) ) { 653 $topic_edit_reason = esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) ); 654 } 655 656 // Update revision log 657 if ( !empty( $_POST['bbp_log_topic_edit'] ) && ( 1 == $_POST['bbp_log_topic_edit'] ) ) { 658 $revision_id = wp_save_post_revision( $topic_id ); 659 if ( ! empty( $revision_id ) ) { 660 bbp_update_topic_revision_log( array( 661 'topic_id' => $topic_id, 662 'revision_id' => $revision_id, 663 'author_id' => bbp_get_current_user_id(), 664 'reason' => $topic_edit_reason 665 ) ); 666 } 667 } 668 669 /** Move Topic ********************************************************/ 691 670 692 671 // If the new forum id is not equal to the old forum id, run the 693 672 // bbp_move_topic action and pass the topic's forum id as the 694 673 // first arg and topic id as the second to update counts. 695 if ( $forum_id != $topic->post_parent ) 674 if ( $forum_id != $topic->post_parent ) { 696 675 bbp_move_topic_handler( $topic_id, $topic->post_parent, $forum_id ); 676 } 677 678 /** Stickies **********************************************************/ 679 680 if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) { 681 682 // What's the dilly? 683 switch ( $_POST['bbp_stick_topic'] ) { 684 685 // Sticky in forum 686 case 'stick' : 687 bbp_stick_topic( $topic_id ); 688 break; 689 690 // Sticky in all forums 691 case 'super' : 692 bbp_stick_topic( $topic_id, true ); 693 break; 694 695 // Normal 696 case 'unstick' : 697 default : 698 bbp_unstick_topic( $topic_id ); 699 break; 700 } 701 } 697 702 698 703 /** Additional Actions (After Save) ***********************************/
Note: See TracChangeset
for help on using the changeset viewer.