Skip to:
Content

BuddyPress.org

Changeset 14029


Ignore:
Timestamp:
09/28/2024 03:30:07 AM (6 months ago)
Author:
espellcaste
Message:

Update the conditional that check if bp_classic is available.

Previously, we only checked if the bp_classic function was available, without checking if the plugin was also active.

Props imath, narenin, samedwards, and espellcaste.

Fixes #9181
Closes https://github.com/buddypress/buddypress/pull/371

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-actions.php

    r13686 r14029  
    123123
    124124    // Fire a deprecation notice for following deprecated hooks, if needed.
    125     if ( ! function_exists( 'bp_classic' ) ) {
     125    if ( ! bp_is_classic() ) {
    126126        apply_filters_deprecated( 'bp_uri', array( '' ), '12.0.0' );
    127127        do_action_deprecated( 'is_not_buddypress', array(), '12.0.0' );
  • trunk/src/bp-core/bp-core-functions.php

    r14026 r14029  
    52895289    return $screen_id === $bp->admin->current_screen;
    52905290}
     5291
     5292/**
     5293 * Common function to check if bp_classic is active or not.
     5294 *
     5295 * @since 15.0.0
     5296 *
     5297 * @return bool True if bp_classic is active, false otherwise.
     5298 */
     5299function bp_is_classic() {
     5300    return function_exists( 'bp_classic' ) || ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'bp-classic/bp-classic.php' ) );
     5301}
  • trunk/src/bp-core/bp-core-update.php

    r13968 r14029  
    862862     * when the BP Classic plugin is not active.
    863863     */
    864     if ( ! function_exists( 'bp_classic' ) ) {
     864    if ( ! bp_is_classic() ) {
    865865        $post_type = bp_core_get_directory_post_type();
    866866
  • trunk/src/bp-core/bp-core-wpabstraction.php

    r13968 r14029  
    430430}
    431431add_action( 'wp_validate_site_deletion', 'bp_delete_site', 10, 2 );
     432
     433if ( ! function_exists( 'is_plugin_active' ) ) {
     434    /**
     435     * Checks if a plugin is active.
     436     *
     437     * @since 15.0.0
     438     *
     439     * @param string $plugin Plugin path to check.
     440     * @return bool True if the plugin is active, false otherwise.
     441     */
     442    function is_plugin_active( $plugin ) {
     443        return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || ( is_multisite() && isset( get_site_option( 'active_sitewide_plugins' )[ $plugin ] ) );
     444    }
     445}
  • trunk/src/bp-core/classes/class-bp-core.php

    r14026 r14029  
    277277
    278278        // Only fully deprecate the legacy navigation globals if BP Classic is not active.
    279         if ( ! function_exists( 'bp_classic' ) ) {
     279        if ( ! bp_is_classic() ) {
    280280            // Backward compatibility for plugins modifying the legacy bp_nav and bp_options_nav global properties.
    281281            $bp->bp_nav         = new BP_Core_BP_Nav_BackCompat();
  • trunk/src/bp-core/deprecated/12.0.php

    r13877 r14029  
    1111
    1212// These functions has been moved to the BP Classic plugin.
    13 if ( ! function_exists( 'bp_classic' ) ) {
     13if ( ! bp_is_classic() ) {
    1414    /**
    1515     * Analyze the URI and break it down into BuddyPress-usable chunks.
  • trunk/src/bp-templates/bp-nouveau/buddypress-functions.php

    r14022 r14029  
    126126            );
    127127
    128             // When BP Classic is activated, regular themes need this filter.
    129             if ( function_exists( 'bp_classic' ) ) {
     128            // When BP Classic is activated, regular themes need this filter. 
     129            if ( bp_is_classic() ) {
    130130                // Set the BP Uri for the Ajax customizer preview.
    131131                add_filter( 'bp_uri', array( $this, 'customizer_set_uri' ), 10, 1 );
Note: See TracChangeset for help on using the changeset viewer.