Skip to:
Content

BuddyPress.org

Ticket #3153: 3153.003.diff

File 3153.003.diff, 2.3 KB (added by cnorris23, 13 years ago)
  • bp-core/bp-core-loader.php

     
    6767                // Pre 1.3 Backwards compatibility
    6868                } elseif ( $deactivated_components = get_site_option( 'bp-deactivated-components' ) ) {
    6969                        // Trim off namespace and filename
    70                         foreach ( $deactivated_components as $component => $value )
     70                        foreach ( (array) $deactivated_components as $component => $value )
    7171                                $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) );
    7272
    7373                        // Set globals
    7474                        $bp->deactivated_components = apply_filters( 'bp_deactivated_components', $trimmed );
    7575
    7676                        // Setup the active components
    77                         $active_components          = array_flip( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ) );
     77                        $active_components     = array_flip( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ) );
    7878
    7979                        // Loop through active components and set the values
    80                         foreach( $active_components as $component => $value )
    81                                 $bp->active_components[$component] = 1;
     80                        $bp->active_components = array_map( '__return_true', $active_components );
    8281
    8382                        // Set the active component global
    84                         $bp->active_components      = apply_filters( 'bp_active_components', $bp->active_components );
     83                        $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components );
     84
     85                // Default to all components active
     86                } else {
     87                        // Set globals
     88                        $bp->deactivated_components = array();
     89
     90                        // Setup the active components
     91                        $active_components     = array_flip( array_values( array_merge( $bp->optional_components, $bp->required_components ) ) );
     92
     93                        // Loop through active components and set the values
     94                        $bp->active_components = array_map( '__return_true', $active_components );
     95
     96                        // Set the active component global
     97                        $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components );
    8598                }
    8699
    87100                // Loop through optional components
     
    195208                                'parent_slug'     => $bp->core->profile->slug,
    196209                                'screen_function' => 'bp_core_catch_profile_uri'
    197210                        );
     211
    198212                }
    199213        }
    200214}