Skip to:
Content

bbPress.org


Ignore:
Timestamp:
03/24/2015 01:32:20 PM (11 years ago)
Author:
johnjamesjacoby
Message:

API: Introduce bbp_redirect()

  • Wraps wp_safe_redirect() & exit() calls
  • Prevents errors from potentially empty wp_get_referrer() results
  • Replace wp_safe_redirect() usages with bbp_redirect()

Fixes #2778.

File:
1 edited

Legend:

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

    r5651 r5658  
    102102 *                    the reply to id
    103103 * @uses bbp_get_reply_url() To get the paginated url to the reply
    104  * @uses wp_safe_redirect() To redirect to the reply url
     104 * @uses bbp_redirect() To redirect to the reply url
    105105 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
    106106 *                                              message
     
    450450
    451451        // Redirect back to new reply
    452         wp_safe_redirect( $reply_url );
    453 
    454         // For good measure
    455         exit();
     452        bbp_redirect( $reply_url );
    456453
    457454    /** Errors ****************************************************************/
     
    492489 *                    and the reply to id
    493490 * @uses bbp_get_reply_url() To get the paginated url to the reply
    494  * @uses wp_safe_redirect() To redirect to the reply url
     491 * @uses bbp_redirect() To redirect to the reply url
    495492 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
    496493 *                                             message
     
    762759
    763760        // Redirect back to new reply
    764         wp_safe_redirect( $reply_url );
    765 
    766         // For good measure
    767         exit();
     761        bbp_redirect( $reply_url );
    768762
    769763    /** Errors ****************************************************************/
     
    12741268 *                    source topic ids and source topic's forum id
    12751269 * @uses bbp_get_topic_permalink() To get the topic permalink
    1276  * @uses wp_safe_redirect() To redirect to the topic link
     1270 * @uses bbp_redirect() To redirect to the topic link
    12771271 */
    12781272function bbp_move_reply_handler( $action = '' ) {
     
    14971491
    14981492    // Redirect back to the topic
    1499     wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) );
    1500 
    1501     // For good measure
    1502     exit();
     1493    bbp_redirect( bbp_get_topic_permalink( $destination_topic->ID ) );
    15031494}
    15041495
     
    15701561 * @uses bbp_get_reply_url() To get the reply url
    15711562 * @uses add_query_arg() To add custom args to the reply url
    1572  * @uses wp_safe_redirect() To redirect to the reply
     1563 * @uses bbp_redirect() To redirect to the reply
    15731564 * @uses bbPress::errors:add() To log the error messages
    15741565 */
     
    16941685
    16951686        // Redirect back to reply
    1696         wp_safe_redirect( $reply_url );
    1697 
    1698         // For good measure
    1699         exit();
     1687        bbp_redirect( $reply_url );
    17001688
    17011689    // Handle errors
     
    23112299 * @uses current_user_can()
    23122300 * @uses bbp_get_topic_id()
    2313  * @uses wp_safe_redirect()
     2301 * @uses bbp_redirect()
    23142302 * @uses bbp_get_topic_permalink()
    23152303 */
     
    23172305
    23182306    // Bail if not editing a topic
    2319     if ( !bbp_is_reply_edit() ) {
     2307    if ( ! bbp_is_reply_edit() ) {
    23202308        return;
    23212309    }
    23222310
    23232311    // User cannot edit topic, so redirect back to reply
    2324     if ( !current_user_can( 'edit_reply', bbp_get_reply_id() ) ) {
    2325         wp_safe_redirect( bbp_get_reply_url() );
    2326         exit();
     2312    if ( ! current_user_can( 'edit_reply', bbp_get_reply_id() ) ) {
     2313        bbp_redirect( bbp_get_reply_url() );
    23272314    }
    23282315}
Note: See TracChangeset for help on using the changeset viewer.