Ticket #3420: 3420.patch
File 3420.patch, 6.3 KB (added by , 4 years ago) |
---|
-
src/includes/forums/functions.php
242 242 243 243 /** Forum Moderation ******************************************************/ 244 244 245 $post_status = bbp_get_public_status_id(); 245 // Default to published 246 $forum_status = bbp_get_public_status_id(); 247 248 // Maybe force into pending 246 249 if ( ! bbp_check_for_moderation( $anonymous_data, $forum_author, $forum_title, $forum_content ) ) { 247 $ post_status = bbp_get_pending_status_id();250 $forum_status = bbp_get_pending_status_id(); 248 251 } 249 252 250 253 /** Additional Actions (Before Save) **************************************/ … … 265 268 'post_title' => $forum_title, 266 269 'post_content' => $forum_content, 267 270 'post_parent' => $forum_parent_id, 268 'post_status' => $ post_status,271 'post_status' => $forum_status, 269 272 'post_type' => bbp_get_forum_post_type(), 270 273 'comment_status' => 'closed' 271 274 ) ); … … 481 484 482 485 /** Forum Moderation ******************************************************/ 483 486 484 $post_status = bbp_get_public_status_id(); 487 // Use existing post_status 488 $forum_status = $forum->post_status; 489 490 // Maybe force into pending 485 491 if ( ! bbp_check_for_moderation( $anonymous_data, bbp_get_forum_author_id( $forum_id ), $forum_title, $forum_content ) ) { 486 $ post_status = bbp_get_pending_status_id();492 $forum_status = bbp_get_pending_status_id(); 487 493 } 488 494 489 495 /** Additional Actions (Before Save) **************************************/ … … 503 509 'ID' => $forum_id, 504 510 'post_title' => $forum_title, 505 511 'post_content' => $forum_content, 506 'post_status' => $ post_status,512 'post_status' => $forum_status, 507 513 'post_parent' => $forum_parent_id 508 514 ) ); 509 515 -
src/includes/replies/functions.php
318 318 319 319 /** Reply Status **********************************************************/ 320 320 321 // Maybe put into moderation 321 // Default to published 322 $reply_status = bbp_get_public_status_id(); 323 324 // Maybe force into pending 322 325 if ( bbp_is_topic_pending( $topic_id ) || ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) { 323 326 $reply_status = bbp_get_pending_status_id(); 324 325 // Default326 } else {327 $reply_status = bbp_get_public_status_id();328 327 } 329 328 330 329 /** Reply To **************************************************************/ … … 633 632 634 633 /** Reply Status **********************************************************/ 635 634 636 // Maybe put into moderation637 if ( ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {635 // Use existing post_status 636 $reply_status = $reply->post_status; 638 637 639 // Set post status to pending if public 640 if ( bbp_get_public_status_id() === $reply->post_status ) { 641 $reply_status = bbp_get_pending_status_id(); 642 } 643 644 // Use existing post_status 645 } else { 646 $reply_status = $reply->post_status; 638 // Maybe force into pending 639 if ( bbp_is_reply_public( $reply_id ) && ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) { 640 $reply_status = bbp_get_pending_status_id(); 647 641 } 648 642 649 643 /** Reply To **************************************************************/ -
src/includes/topics/functions.php
264 264 // Get available topic statuses 265 265 $topic_statuses = bbp_get_topic_statuses(); 266 266 267 // Maybe put into moderation 267 // Default to published 268 $topic_status = bbp_get_public_status_id(); 269 270 // Maybe force into pending 268 271 if ( ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) { 269 272 $topic_status = bbp_get_pending_status_id(); 270 273 271 // Check possible topic status ID's274 // Check for possible posted topic status 272 275 } elseif ( ! empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( $topic_statuses ), true ) ) { 273 $topic_status = sanitize_key( $_POST['bbp_topic_status'] );274 276 275 // Default to published if nothing else 276 } else { 277 $topic_status = bbp_get_public_status_id(); 277 // Allow capable users to explicitly override the status 278 if ( current_user_can( 'moderate', $forum_id ) ) { 279 $topic_status = sanitize_key( $_POST['bbp_topic_status'] ); 280 281 // Not capable 282 } else { 283 bbp_add_error( 'bbp_new_topic_status', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) ); 284 } 278 285 } 279 286 280 287 /** Topic Tags ************************************************************/ … … 560 567 // Get available topic statuses 561 568 $topic_statuses = bbp_get_topic_statuses( $topic_id ); 562 569 563 // Maybe put into moderation564 if ( ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {570 // Use existing post_status 571 $topic_status = $topic->post_status; 565 572 566 // Set post status to pending if public or closed 567 if ( bbp_is_topic_public( $topic->ID ) ) { 568 $topic_status = bbp_get_pending_status_id(); 569 } 573 // Maybe force into pending 574 if ( bbp_is_topic_public( $topic->ID ) && ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) { 575 $topic_status = bbp_get_pending_status_id(); 570 576 571 // Check possible topic status ID's577 // Check for possible posted topic status 572 578 } elseif ( ! empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( $topic_statuses ), true ) ) { 573 $topic_status = sanitize_key( $_POST['bbp_topic_status'] );574 579 575 // Use existing post_status 576 } else { 577 $topic_status = $topic->post_status; 580 // Allow capable users to explicitly override the status 581 if ( current_user_can( 'moderate', $forum_id ) ) { 582 $topic_status = sanitize_key( $_POST['bbp_topic_status'] ); 583 584 // Not capable 585 } else { 586 bbp_add_error( 'bbp_edit_topic_status', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) ); 587 } 578 588 } 579 589 580 590 /** Topic Tags ************************************************************/