Skip to:
Content

BuddyPress.org

Changeset 5320


Ignore:
Timestamp:
11/09/2011 06:54:53 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Move $bp_no_status_set global into $bp global, and more improvements to bp-core-catchuri.php.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-catchuri.php

    r5319 r5320  
    400400 */
    401401function bp_core_catch_profile_uri() {
    402         global $bp;
    403 
    404         if ( !bp_is_active( 'xprofile' ) )
     402        if ( !bp_is_active( 'xprofile' ) ) {
    405403                bp_core_load_template( apply_filters( 'bp_core_template_display_profile', 'members/single/home' ) );
     404        }
    406405}
    407406
     
    413412 */
    414413function bp_core_catch_no_access() {
    415         global $bp, $bp_no_status_set, $wp_query;
    416 
    417         // If bp_core_redirect() and $bp_no_status_set is true,
    418         // we are redirecting to an accessible page, so skip this check.
    419         if ( $bp_no_status_set )
     414        global $bp, $wp_query;
     415
     416        // If coming from bp_core_redirect() and $bp_no_status_set is true,
     417        // we are redirecting to an accessible page so skip this check.
     418        if ( !empty( $bp->no_status_set ) )
    420419                return false;
    421420
     
    435434 */
    436435function bp_core_no_access( $args = '' ) {
    437         global $bp;
    438436
    439437        $defaults = array(
     
    441439                'message'  => __( 'You must log in to access the page you requested.', 'buddypress' ),
    442440                'redirect' => wp_guess_url(),   // the URL you get redirected to when a user successfully logs in
    443                 'root'     => $bp->root_domain  // the landing page you get redirected to when a user doesn't have access
     441                'root'     => bp_get_root_domain()      // the landing page you get redirected to when a user doesn't have access
    444442        );
    445443
    446444        $r = wp_parse_args( $args, $defaults );
     445        $r = apply_filters_ref_array( 'bp_core_no_access', $r );
    447446        extract( $r, EXTR_SKIP );
    448447
    449         // Apply filters to these variables
     448        /**
     449         * @ignore Ignore these filters and use 'bp_core_no_access' above
     450         */
    450451        $mode           = apply_filters( 'bp_no_access_mode',     $mode,     $root,     $redirect, $message );
    451452        $redirect       = apply_filters( 'bp_no_access_redirect', $redirect, $root,     $message,  $mode    );
     
    470471                case 1 :
    471472                default :
    472                         if ( $redirect ) {
     473
     474                        $url = $root;
     475                        if ( !empty( $redirect ) )
    473476                                $url = add_query_arg( 'redirect_to', urlencode( $redirect ), $root );
    474                         } else {
    475                                 $url = $root;
    476                         }
    477 
    478                         if ( $message ) {
     477
     478                        if ( !empty( $message ) ) {
    479479                                bp_core_add_message( $message, 'error' );
    480480                        }
  • trunk/bp-core/bp-core-functions.php

    r5309 r5320  
    831831 *
    832832 * @package BuddyPress Core
    833  * @global $bp_no_status_set Makes sure that there are no conflicts with status_header() called in bp_core_do_catch_uri()
    834  * @uses get_themes()
    835  * @return An array containing all of the themes.
     833 * @global BuddyPress $bp Makes sure that there are no conflicts with
     834 *                         status_header() called in bp_core_do_catch_uri()
     835 * @uses wp_redirect()
    836836 */
    837837function bp_core_redirect( $location, $status = 302 ) {
    838         global $bp_no_status_set;
     838        global $bp;
    839839
    840840        // Make sure we don't call status_header() in bp_core_do_catch_uri()
    841841        // as this conflicts with wp_redirect()
    842         $bp_no_status_set = true;
     842        $bp->no_status_set = true;
    843843
    844844        wp_redirect( $location, $status );
  • trunk/bp-loader.php

    r5317 r5320  
    155155         */
    156156        public $unfiltered_uri_offset = 0;
    157        
     157
     158        /**
     159         * @var bool Are status headers already sent?
     160         */
     161        public $no_status_set = false;
     162
    158163        /** Components ************************************************************/
    159164
Note: See TracChangeset for help on using the changeset viewer.