diff --git a/src/bp-core/admin/bp-core-admin-components.php b/src/bp-core/admin/bp-core-admin-components.php
index 79f20d6db..7cbad26d1 100644
a
|
b
|
function bp_core_admin_components_options() { |
51 | 51 | |
52 | 52 | // Declare local variables. |
53 | 53 | $deactivated_components = array(); |
54 | | |
55 | | /** |
56 | | * Filters the array of available components. |
57 | | * |
58 | | * @since 1.5.0 |
59 | | * |
60 | | * @param mixed $value Active components. |
61 | | */ |
62 | | $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); |
| 54 | $active_components = bp_core_get_active_components(); |
63 | 55 | |
64 | 56 | // The default components (if none are previously selected). |
65 | 57 | $default_components = array( |
diff --git a/src/bp-core/admin/bp-core-admin-schema.php b/src/bp-core/admin/bp-core-admin-schema.php
index 02a410ba9..438859549 100644
a
|
b
|
function bp_core_install( $active_components = false ) { |
26 | 26 | |
27 | 27 | // If no components passed, get all the active components from the main site. |
28 | 28 | if ( empty( $active_components ) ) { |
29 | | |
30 | | /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ |
31 | | $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); |
| 29 | $active_components = bp_core_get_active_components(); |
32 | 30 | } |
33 | 31 | |
34 | 32 | // Install Activity Streams even when inactive (to store last_activity data). |
diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php
index d88db32d9..51ffbf1c9 100644
a
|
b
|
function bp_core_get_components( $type = 'all' ) { |
2527 | 2527 | return apply_filters( 'bp_core_get_components', $components, $type ); |
2528 | 2528 | } |
2529 | 2529 | |
| 2530 | /** |
| 2531 | * Return a list of active components. |
| 2532 | * |
| 2533 | * @since 3.0.0 |
| 2534 | * |
| 2535 | * @return array Active components. |
| 2536 | */ |
| 2537 | function bp_core_get_active_components() { |
| 2538 | $active_components = bp_get_option( 'bp-active-components' ); |
| 2539 | |
| 2540 | /** |
| 2541 | * Filters the list of active components. |
| 2542 | * |
| 2543 | * @since 1.5.0 |
| 2544 | * |
| 2545 | * @param array $active_components Array of active component information. |
| 2546 | */ |
| 2547 | return apply_filters( 'bp_active_components', $active_components ); |
| 2548 | } |
| 2549 | |
| 2550 | /** |
| 2551 | * Return a list of inactive (or "deactivated") components. |
| 2552 | * |
| 2553 | * @since 3.0.0 |
| 2554 | * |
| 2555 | * @return array Inactive components. |
| 2556 | */ |
| 2557 | function bp_core_get_inactive_components() { |
| 2558 | $inactive_components = array_values( |
| 2559 | array_diff( |
| 2560 | array_values( |
| 2561 | array_merge( $bp->optional_components, $bp->required_components ) |
| 2562 | ), |
| 2563 | array_keys( |
| 2564 | bp_core_get_active_components() |
| 2565 | ) |
| 2566 | ) |
| 2567 | ); |
| 2568 | |
| 2569 | /** |
| 2570 | * Filters the list of inactive (or "deactivated") components. |
| 2571 | * |
| 2572 | * The filter is named "deactivated" rather than "inactive" for backwards compatibility reasons. |
| 2573 | * |
| 2574 | * @since 3.0.0 |
| 2575 | * |
| 2576 | * @param array $inactive_components Inactive components. |
| 2577 | */ |
| 2578 | return apply_filters( 'bp_deactivated_components', $inactive_components ); |
| 2579 | } |
| 2580 | |
2530 | 2581 | /** Nav Menu ******************************************************************/ |
2531 | 2582 | |
2532 | 2583 | /** |
diff --git a/src/bp-core/classes/class-bp-core.php b/src/bp-core/classes/class-bp-core.php
index 2afcf77c8..70af4cfd9 100644
a
|
b
|
class BP_Core extends BP_Component { |
76 | 76 | */ |
77 | 77 | $bp->required_components = apply_filters( 'bp_required_components', array( 'members' ) ); |
78 | 78 | |
79 | | // Get a list of activated components. |
80 | | if ( $active_components = bp_get_option( 'bp-active-components' ) ) { |
| 79 | $active_components = bp_core_get_active_components(); |
| 80 | $deactivated_components = bp_get_option( 'bp-deactivated-components' ); |
81 | 81 | |
82 | | /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ |
83 | | $bp->active_components = apply_filters( 'bp_active_components', $active_components ); |
| 82 | if ( $active_components ) { |
| 83 | $bp->active_components = $active_components; |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Filters the deactivated components. |
… |
… |
class BP_Core extends BP_Component { |
92 | 92 | $bp->deactivated_components = apply_filters( 'bp_deactivated_components', array_values( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_keys( $bp->active_components ) ) ) ); |
93 | 93 | |
94 | 94 | // Pre 1.5 Backwards compatibility. |
95 | | } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) { |
| 95 | } elseif ( $deactivated_components ) { |
96 | 96 | |
97 | 97 | // Trim off namespace and filename. |
98 | 98 | foreach ( array_keys( (array) $deactivated_components ) as $component ) { |
99 | 99 | $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) ); |
100 | 100 | } |
101 | 101 | |
102 | | /** This filter is documented in bp-core/bp-core-loader.php */ |
| 102 | /** This filter is documented in bp-core/bp-core-functions.php */ |
103 | 103 | $bp->deactivated_components = apply_filters( 'bp_deactivated_components', $trimmed ); |
104 | 104 | |
105 | 105 | // Setup the active components. |
106 | 106 | $active_components = array_fill_keys( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ), '1' ); |
107 | 107 | |
108 | | /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ |
| 108 | /** This filter is documented in bp-core/bp-core-functions.php */ |
109 | 109 | $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components ); |
110 | 110 | |
111 | 111 | // Default to all components active. |
… |
… |
class BP_Core extends BP_Component { |
117 | 117 | // Setup the active components. |
118 | 118 | $active_components = array_fill_keys( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), '1' ); |
119 | 119 | |
120 | | /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ |
| 120 | /** This filter is documented in bp-core/bp-core-functions.php */ |
121 | 121 | $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components ); |
122 | 122 | } |
123 | 123 | |