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/users/functions.php

    r5657 r5658  
    2323 * @uses home_url() To get the home url
    2424 * @uses esc_url() To escape the url
    25  * @uses wp_safe_redirect() To redirect
     25 * @uses bbp_redirect() To redirect
    2626 */
    2727function bbp_redirect_login( $url = '', $raw_url = '', $user = '' ) {
     
    395395 * @uses bbp_get_favorites_link() To get the favorites page link
    396396 * @uses bbp_get_topic_permalink() To get the topic permalink
    397  * @uses wp_safe_redirect() To redirect to the url
     397 * @uses bbp_redirect() To redirect to the url
    398398 */
    399399function bbp_favorites_handler( $action = '' ) {
     
    471471        }
    472472
    473         wp_safe_redirect( $redirect );
    474 
    475         // For good measure
    476         exit();
     473        bbp_redirect( $redirect );
    477474
    478475    // Fail! Handle errors
     
    11161113 * @uses bbp_is_subscription() To check if it's the subscription page
    11171114 * @uses bbp_get_forum_permalink() To get the forum permalink
    1118  * @uses wp_safe_redirect() To redirect to the url
     1115 * @uses bbp_redirect() To redirect to the url
    11191116 */
    11201117function bbp_forum_subscriptions_handler( $action = '' ) {
     
    11921189        }
    11931190
    1194         wp_safe_redirect( $redirect );
    1195 
    1196         // For good measure
    1197         exit();
     1191        bbp_redirect( $redirect );
    11981192
    11991193    // Fail! Handle errors
     
    12221216 * @uses bbp_is_subscription() To check if it's the subscription page
    12231217 * @uses bbp_get_topic_permalink() To get the topic permalink
    1224  * @uses wp_safe_redirect() To redirect to the url
     1218 * @uses bbp_redirect() To redirect to the url
    12251219 */
    12261220function bbp_subscriptions_handler( $action = '' ) {
     
    12981292        }
    12991293
    1300         wp_safe_redirect( $redirect );
    1301 
    1302         // For good measure
    1303         exit();
     1294        bbp_redirect( $redirect );
    13041295
    13051296    // Fail! Handle errors
     
    13271318 * @uses delete_option() To delete the displayed user's email id option
    13281319 * @uses bbp_get_user_profile_edit_url() To get the edit profile url
    1329  * @uses wp_safe_redirect() To redirect to the url
     1320 * @uses bbp_redirect() To redirect to the url
    13301321 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
    13311322 * @uses current_user_can() To check if the current user can edit the user
     
    13711362            delete_option( $user_id . '_new_email' );
    13721363
    1373             wp_safe_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) );
    1374             exit();
     1364            bbp_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) );
    13751365        }
    13761366
     
    13781368    } elseif ( is_multisite() && bbp_is_user_home_edit() && ! empty( $_GET['dismiss'] ) && ( $user_id . '_new_email' === $_GET['dismiss'] ) ) {
    13791369        delete_option( $user_id . '_new_email' );
    1380         wp_safe_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) );
    1381         exit();
     1370        bbp_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) );
    13821371    }
    13831372
     
    14201409        $redirect = add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $edit_user ) );
    14211410
    1422         wp_safe_redirect( $redirect );
    1423         exit;
     1411        bbp_redirect( $redirect );
    14241412    }
    14251413}
     
    17041692 * @uses current_user_can()
    17051693 * @uses bbp_get_displayed_user_id()
    1706  * @uses wp_safe_redirect()
     1694 * @uses bbp_redirect()
    17071695 * @uses bbp_get_user_profile_url()
    17081696 */
     
    17441732
    17451733    // Redirect
    1746     wp_safe_redirect( $redirect_to );
    1747     exit();
     1734    bbp_redirect( $redirect_to );
    17481735}
    17491736
Note: See TracChangeset for help on using the changeset viewer.