Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/29/2011 01:51:02 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Improve the current title area of breadcrumbs.
Improve behavior of redirect field.
Allow single topic shortcodes to use pagination, and properly redirect on new replies.
Use wp_safe_redirect() in places where redirect_to fields are used.
Move theme compatibility setup function out of main bbPress class and into bbp-core-compatibility.php.
Move bbp_setup_theme_compat action off of after_setup_theme and into bbp_init.
Add supplemental functions to get and set if theme compatibility is currently helping load pieces of the current page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-functions.php

    r3255 r3265  
    134134 *                    id, anonymous data and reply author
    135135 * @uses bbp_get_reply_url() To get the paginated url to the reply
    136  * @uses wp_redirect() To redirect to the reply url
     136 * @uses wp_safe_redirect() To redirect to the reply url
    137137 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
    138138 *                                              message
     
    304304                /** Redirect **************************************************/
    305305
    306                 $reply_url = bbp_get_reply_url( $reply_id );
    307 
    308                 if ( ( !empty( $_GET['view'] ) && ( 'all' === $_GET['view'] ) ) || ( $reply_data['post_status'] == $bbp->trash_status_id ) )
     306                // Redirect to
     307                $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
     308
     309                // View all?
     310                $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) || ( $reply_data['post_status'] == $bbp->trash_status_id ) );
     311
     312                // Get the reply URL
     313                $reply_url = bbp_get_reply_url( $reply_id, $count_hidden, $redirect_to );
     314
     315                // Add view all?
     316                if ( !empty( $count_hidden ) )
    309317                    $reply_url = add_query_arg( array( 'view' => 'all' ), $reply_url );
    310318
    311                 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url );
     319                // Allow to be filtered
     320                $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $count_hidden, $redirect_to );
    312321
    313322                /** Successful Save *******************************************/
    314323
    315324                // Redirect back to new reply
    316                 wp_redirect( $reply_url );
     325                wp_safe_redirect( $reply_url );
    317326
    318327                // For good measure
     
    355364 *                    id, anonymous data, reply author and bool true (for edit)
    356365 * @uses bbp_get_reply_url() To get the paginated url to the reply
    357  * @uses wp_redirect() To redirect to the reply url
     366 * @uses wp_safe_redirect() To redirect to the reply url
    358367 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
    359368 *                                             message
     
    525534                do_action( 'bbp_edit_reply_post_extras', $reply_id );
    526535
     536                /** Redirect **************************************************/
     537
     538                // Redirect to
     539                $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
     540
     541                // View all?
     542                $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) );
     543
     544                // Get the reply URL
     545                $reply_url = bbp_get_reply_url( $reply_id, $count_hidden, $redirect_to );
     546
     547                // Add view all?
     548                if ( !empty( $count_hidden ) )
     549                    $reply_url = add_query_arg( array( 'view' => 'all' ), $reply_url );
     550
     551                // Allow to be filtered
     552                $reply_url = apply_filters( 'bbp_edit_reply_redirect_to', $reply_url, $count_hidden, $redirect_to );
     553
    527554                /** Successful Edit *******************************************/
    528555
    529556                // Redirect back to new reply
    530                 wp_redirect( bbp_get_reply_url( $reply_id ) );
     557                wp_safe_redirect( $reply_url );
    531558
    532559                // For good measure
Note: See TracChangeset for help on using the changeset viewer.