Skip to:
Content

bbPress.org

Changeset 7864


Ignore:
Timestamp:
10/08/2026 04:22:00 PM (2 weeks ago)
Author:
johnjamesjacoby
Message:

Moderation: Avoid returning after pending notices.

Keep pending submissions in the current request without using the error queue as a control-flow boundary. Only enter redirect handling for submissions that are not pending moderation.

In trunk, for 2.7.

See #3353.

Location:
trunk/src/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/functions.php

    r7861 r7864  
    512512                        bbp_add_error( 'bbp_reply_moderated', esc_html__( 'Your reply is pending moderation.', 'bbpress' ) );
    513513                        unset( $_POST['bbp_reply_title'], $_POST['bbp_reply_content'], $_POST['bbp_topic_tags'] );
    514                         return;
     514
     515                } else {
     516                        /** Redirect ******************************************************/
     517
     518                        // Redirect to
     519                        $redirect_to = bbp_get_redirect_to();
     520
     521                        // Get the reply URL
     522                        $reply_url = bbp_get_reply_url( $reply_id, $redirect_to );
     523
     524                        // Allow to be filtered
     525                        $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id );
     526
     527                        /** Successful Save ***************************************************/
     528
     529                        // Redirect back to new reply
     530                        bbp_redirect( $reply_url );
    515531                }
    516 
    517                 /** Redirect **********************************************************/
    518 
    519                 // Redirect to
    520                 $redirect_to = bbp_get_redirect_to();
    521 
    522                 // Get the reply URL
    523                 $reply_url = bbp_get_reply_url( $reply_id, $redirect_to );
    524 
    525                 // Allow to be filtered
    526                 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id );
    527 
    528                 /** Successful Save ***************************************************/
    529 
    530                 // Redirect back to new reply
    531                 bbp_redirect( $reply_url );
    532532
    533533        /** Errors ****************************************************************/
  • trunk/src/includes/topics/functions.php

    r7861 r7864  
    407407                        bbp_add_error( 'bbp_topic_moderated', esc_html__( 'Your topic is pending moderation.', 'bbpress' ) );
    408408                        unset( $_POST['bbp_topic_title'], $_POST['bbp_topic_content'], $_POST['bbp_topic_tags'] );
    409                         return;
    410                 }
    411 
    412                 /** Redirect **********************************************************/
    413 
    414                 // Redirect to
    415                 $redirect_to = bbp_get_redirect_to();
    416 
    417                 // Get the topic URL
    418                 $redirect_url = bbp_get_topic_permalink( $topic_id, $redirect_to );
    419 
    420                 // Add view all?
    421                 if ( bbp_get_view_all() || ! empty( $view_all ) ) {
    422 
    423                         // User can moderate, so redirect to topic with view all set
    424                         if ( current_user_can( 'moderate', $topic_id ) ) {
    425                                 $redirect_url = bbp_add_view_all( $redirect_url );
    426 
    427                         // User cannot moderate, so redirect to forum
    428                         } else {
    429                                 $redirect_url = bbp_get_forum_permalink( $forum_id );
     409
     410                } else {
     411                        /** Redirect ******************************************************/
     412
     413                        // Redirect to
     414                        $redirect_to = bbp_get_redirect_to();
     415
     416                        // Get the topic URL
     417                        $redirect_url = bbp_get_topic_permalink( $topic_id, $redirect_to );
     418
     419                        // Add view all?
     420                        if ( bbp_get_view_all() || ! empty( $view_all ) ) {
     421
     422                                // User can moderate, so redirect to topic with view all set
     423                                if ( current_user_can( 'moderate', $topic_id ) ) {
     424                                        $redirect_url = bbp_add_view_all( $redirect_url );
     425
     426                                // User cannot moderate, so redirect to forum
     427                                } else {
     428                                        $redirect_url = bbp_get_forum_permalink( $forum_id );
     429                                }
    430430                        }
    431                 }
    432 
    433                 // Allow to be filtered
    434                 $redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to, $topic_id );
    435 
    436                 /** Successful Save ***************************************************/
    437 
    438                 // Redirect back to new topic
    439                 bbp_redirect( $redirect_url );
     431
     432                        // Allow to be filtered
     433                        $redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to, $topic_id );
     434
     435                        /** Successful Save ***************************************************/
     436
     437                        // Redirect back to new topic
     438                        bbp_redirect( $redirect_url );
     439                }
    440440
    441441        /** Errors ****************************************************************/
Note: See TracChangeset for help on using the changeset viewer.