Skip to:
Content

bbPress.org

Changeset 4533


Ignore:
Timestamp:
11/28/2012 09:33:34 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Redirect:

  • Rethink the way bbp_redirect_to_field() works.
  • Removes apache specific global checks.
  • Fixes incorrect usage of wp_get_referer().
  • Props MZAWeb.
  • fixes #1835.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/template-tags.php

    r4529 r4533  
    10851085 *
    10861086 * The referer link is the current Request URI from the server super global. The
    1087  * input name is '_wp_http_referer', in case you wanted to check manually.
     1087 * input name is 'redirect_to', in case you wanted to check manually.
    10881088 *
    10891089 * @since bbPress (r2815)
    10901090 *
    1091  * @param string $url Pass a URL to redirect to
     1091 * @param string $redirect_to Pass a URL to redirect to
     1092 *
    10921093 * @uses wp_get_referer() To get the referer
    10931094 * @uses esc_attr() To escape the url
    1094  * @uses apply_filters() Calls 'bbp_redirect_to_field' with the referer field
    1095  *                        and url
     1095 * @uses apply_filters() Calls 'bbp_redirect_to_field', passes field and to
    10961096 */
    10971097function bbp_redirect_to_field( $redirect_to = '' ) {
    1098 
    1099     // Rejig the $redirect_to
    1100     if ( !isset( $_SERVER['REDIRECT_URL'] ) || ( !$redirect_to == home_url( $_SERVER['REDIRECT_URL'] ) ) )
    1101         $redirect_to = wp_get_referer();
    11021098
    11031099    // Make sure we are directing somewhere
    11041100    if ( empty( $redirect_to ) )
    1105         $redirect_to = home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' );
     1101        $redirect_to = home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : wp_get_referer() );
    11061102
    11071103    // Remove loggedout query arg if it's there
Note: See TracChangeset for help on using the changeset viewer.