Ticket #1988: 1988.2.diff
File 1988.2.diff, 7.0 KB (added by , 9 years ago) |
---|
-
src/includes/common/functions.php
diff --git src/includes/common/functions.php src/includes/common/functions.php index 8afcb14..f8a2ca1 100644
function bbp_get_view_all( $cap = 'moderate' ) { 300 300 } 301 301 302 302 /** 303 * Append 'pending=type' to query string if it's already there from referer. 304 * 305 * @since 2.6.0 bbPress (rXXXX) 306 * 307 * @param string $original_link Original Link to be modified. 308 * @param string $type The type of object pending. 309 * 310 * @return string The link with 'pending=type' appended if necessary. 311 */ 312 function bbp_add_pending( $original_link = '', $type = '' ) { 313 314 // Appending the pending=type vars. 315 $link = add_query_arg( array( 'pending' => $type ), $original_link ); 316 317 return apply_filters( 'bbp_add_pending', $link, $original_link ); 318 } 319 320 /** 321 * Remove 'pending=type' from query string. 322 * 323 * @since 2.6.0 bbPress (rXXXX) 324 * 325 * @param string $original_link Original Link to be modified. 326 * 327 * @return string The link with 'pending=type' appended if necessary. 328 */ 329 function bbp_remove_pending( $original_link = '' ) { 330 return apply_filters( 'bbp_remove_pending', remove_query_arg( 'pending', $original_link ), $original_link ); 331 } 332 333 /** 334 * If the pending query arg exists. 335 * 336 * @since 2.6.0 bbPress (rXXXX) 337 * 338 * @return bool Whether the pending query arg exists. 339 */ 340 function bbp_get_pending() { 341 $retval = ( isset( $_GET['pending'] ) && in_array( $_GET['pending'], array( 'forum', 'topic', 'reply' ), true ) ); 342 return (bool) apply_filters( 'bbp_get_pending', $retval ); 343 } 344 345 /** 303 346 * Assist pagination by returning correct page number 304 347 * 305 348 * @since 2.0.0 bbPress (r2628) -
src/includes/common/template.php
diff --git src/includes/common/template.php src/includes/common/template.php index 5e938e2..a92282a 100644
function bbp_allowed_tags() { 2493 2493 /** Errors & Messages *********************************************************/ 2494 2494 2495 2495 /** 2496 * Displays the pending forum/topic/reply notice. 2497 * 2498 * @since 2.6.0 bbPress (rXXXX) 2499 * 2500 * @return void 2501 */ 2502 function bbp_pending_notices() { 2503 2504 // Bail if we don't have a pending query arg. 2505 if ( ! bbp_get_pending() ) { 2506 return; 2507 } 2508 2509 // Get the pending object type. 2510 $type = sanitize_key( $_GET['pending'] ); 2511 2512 // Set the notice text based on the object type. 2513 switch ( $type ) { 2514 2515 case 'forum' : 2516 $notice_text = __( 'Your forum has been successfully submitted and is pending moderator approval.', 'bbpress' ); 2517 break; 2518 2519 case 'topic' : 2520 $notice_text = __( 'Your topic has been successfully submitted and is pending moderator approval.', 'bbpress' ); 2521 break; 2522 2523 case 'reply' : 2524 $notice_text = __( 'Your reply has been successfully submitted and is pending moderator approval.', 'bbpress' ); 2525 break; 2526 2527 default : 2528 $notice_text = ''; 2529 break; 2530 } 2531 2532 // Filter notice text and bail if empty. 2533 $notice_text = apply_filters( 'bbp_pending_notices', $notice_text, $type ); 2534 if ( empty( $notice_text ) ) { 2535 return; 2536 } 2537 2538 bbp_add_error( 'bbp_pending_notices', $notice_text, 'message' ); 2539 } 2540 2541 /** 2496 2542 * Display possible errors & messages inside a template file 2497 2543 * 2498 2544 * @since 2.0.0 bbPress (r2688) -
src/includes/core/actions.php
diff --git src/includes/core/actions.php src/includes/core/actions.php index c9efadb..f847692 100644
add_action( 'bbp_widgets_init', array( 'BBP_Stats_Widget', 'register_widget' ) 146 146 // Notices (loaded after bbp_init for translations) 147 147 add_action( 'bbp_head', 'bbp_login_notices' ); 148 148 add_action( 'bbp_head', 'bbp_topic_notices' ); 149 add_action( 'bbp_init', 'bbp_pending_notices' ); 149 150 add_action( 'bbp_template_notices', 'bbp_template_notices' ); 150 151 151 152 // Always exclude private/hidden forums if needed -
src/includes/forums/functions.php
diff --git src/includes/forums/functions.php src/includes/forums/functions.php index ff6c07e..91dc19c 100644
function bbp_new_forum_handler( $action = '' ) { 343 343 // Get the forum URL 344 344 $redirect_url = bbp_get_forum_permalink( $forum_id, $redirect_to ); 345 345 346 // Maybe add a 'pending=forum' query arg. 347 if ( $forum_data['post_status'] === bbp_get_pending_status_id() ) { 348 $redirect_url = bbp_add_pending( $redirect_url, 'forum' ); 349 } 350 346 351 // Add view all? 347 352 if ( bbp_get_view_all() || ! empty( $view_all ) ) { 348 353 … … function bbp_edit_forum_handler( $action = '' ) { 627 632 // Get the forum URL 628 633 $forum_url = bbp_get_forum_permalink( $forum_id, $redirect_to ); 629 634 635 // Maybe add a 'pending=forum' query arg. 636 if ( $forum_data['post_status'] === bbp_get_pending_status_id() ) { 637 $forum_url = bbp_add_pending( $forum_url, 'forum' ); 638 } 639 630 640 // Add view all? 631 641 if ( ! empty( $view_all ) ) { 632 642 $forum_url = bbp_add_view_all( $forum_url ); -
src/includes/replies/functions.php
diff --git src/includes/replies/functions.php src/includes/replies/functions.php index bb66f52..4ab169c 100644
function bbp_new_reply_handler( $action = '' ) { 482 482 // Get the reply URL 483 483 $reply_url = bbp_get_reply_url( $reply_id, $redirect_to ); 484 484 485 // Maybe add a 'pending=reply' query arg. 486 if ( $reply_data['post_status'] === bbp_get_pending_status_id() ) { 487 $reply_url = bbp_add_pending( $reply_url, 'reply' ); 488 } 489 485 490 // Allow to be filtered 486 491 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id ); 487 492 … … function bbp_edit_reply_handler( $action = '' ) { 788 793 // Get the reply URL 789 794 $reply_url = bbp_get_reply_url( $reply_id, $redirect_to ); 790 795 796 // Maybe add a 'pending=reply' query arg. 797 if ( $reply_data['post_status'] === bbp_get_pending_status_id() ) { 798 $reply_url = bbp_add_pending( $reply_url, 'reply' ); 799 } 800 791 801 // Allow to be filtered 792 802 $reply_url = apply_filters( 'bbp_edit_reply_redirect_to', $reply_url, $redirect_to ); 793 803 -
src/includes/topics/functions.php
diff --git src/includes/topics/functions.php src/includes/topics/functions.php index 1f5089e..55a1d81 100644
function bbp_new_topic_handler( $action = '' ) { 433 433 // Get the topic URL 434 434 $redirect_url = bbp_get_topic_permalink( $topic_id, $redirect_to ); 435 435 436 // Maybe add a 'pending=topic' query arg. 437 if ( $topic_data['post_status'] === bbp_get_pending_status_id() ) { 438 $redirect_url = bbp_add_pending( $redirect_url, 'topic' ); 439 } 440 436 441 // Add view all? 437 442 if ( bbp_get_view_all() || ! empty( $view_all ) ) { 438 443 … … function bbp_edit_topic_handler( $action = '' ) { 808 813 // Get the topic URL 809 814 $topic_url = bbp_get_topic_permalink( $topic_id, $redirect_to ); 810 815 816 // Maybe add a 'pending=topic' query arg. 817 if ( $topic_data['post_status'] === bbp_get_pending_status_id() ) { 818 $topic_url = bbp_add_pending( $topic_url, 'topic' ); 819 } 820 811 821 // Add view all? 812 822 if ( ! empty( $view_all ) ) { 813 823 $topic_url = bbp_add_view_all( $topic_url );