Skip to:
Content

BuddyPress.org


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.

File:
1 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                        }
Note: See TracChangeset for help on using the changeset viewer.