Skip to:
Content

BuddyPress.org

Ticket #7730: 7730.01.patch

File 7730.01.patch, 1.6 KB (added by DJPaul, 5 years ago)
  • src/bp-core/bp-core-options.php

    diff --git a/src/bp-core/bp-core-options.php b/src/bp-core/bp-core-options.php
    index de638993d..ec44b01e4 100644
    a b function bp_is_activity_heartbeat_active( $default = true ) { 
    756756}
    757757
    758758/**
    759  * Get the current theme package ID.
     759 * Get the current template pack ID.
    760760 *
    761761 * @since 1.7.0
     762 * @since 3.0.0 Add support for WordPress themes to override template pack selection.
    762763 *
    763  * @param string $default Optional. Fallback value if not found in the database.
    764  *                        Default: 'legacy'.
    765  * @return string ID of the theme package.
     764 * @param string $default Optional. Fallback value if no preference set. Default: 'legacy'.
     765 *
     766 * @return string ID of the template pack.
    766767 */
    767768function bp_get_theme_package_id( $default = 'legacy' ) {
     769        $active_package = bp_get_option( '_bp_theme_package_id', $default );
     770        $all_packages   = array_keys( buddypress()->theme_compat->packages );
     771
     772        foreach ( $all_packages as $package ) {
     773                // e.g. "buddypress-use-nouveau", "buddypress-use-legacy".
     774                if ( current_theme_supports( "buddypress-use-{$package}" ) ) {
     775                        $active_package = $package;
     776                        break;
     777                }
     778        }
    768779
    769780        /**
    770          * Filters the current theme package ID.
     781         * Filters the current template pack ID.
    771782         *
    772783         * @since 1.7.0
    773784         *
    774          * @param string $value The current theme package ID.
     785         * @param string $value The template pack ID.
    775786         */
    776         return apply_filters( 'bp_get_theme_package_id', bp_get_option( '_bp_theme_package_id', $default ) );
     787        return apply_filters( 'bp_get_theme_package_id', $active_package );
    777788}