Skip to:
Content

BuddyPress.org

Changeset 14204


Ignore:
Timestamp:
06/03/2026 06:44:50 PM (6 weeks ago)
Author:
dcavins
Message:

Restore no-js body class for BuddyPress pages. (12.0 branch)

Regression introduced at [13672], part of [13418].

Props r-a-y and vapvarun.

See #8679
See #9304 (14.0)

Location:
branches/12.0/src/bp-templates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/12.0/src/bp-templates/bp-legacy/buddypress-functions.php

    r14110 r14204  
    8585                add_action( 'bp_enqueue_community_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
    8686
    87                 /** This filter is documented in bp-core/bp-core-dependency.php */
    88                 if ( is_buddypress() || ! apply_filters( 'bp_enqueue_assets_in_bp_pages_only', true ) ) {
    89                         // Body no-js class.
    90                         add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
    91                 }
     87                // Body no-js class.
     88                add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
    9289
    9390                /** Buttons ***********************************************************/
     
    476473         * @since 1.7.0
    477474         *
    478          * @param array $classes Array of classes to append to body tag.
    479          * @return array $classes
     475         * @param string[] $classes Array of classes to append to body tag.
     476         * @return string[]
    480477         */
    481478        public function add_nojs_body_class( $classes ) {
    482                 if ( ! in_array( 'no-js', $classes ) )
    483                         $classes[] = 'no-js';
     479                /** This filter is documented in bp-core/bp-core-dependency.php */
     480                if ( ! is_buddypress() || apply_filters( 'bp_enqueue_assets_in_bp_pages_only', true ) ) {
     481                        return $classes;
     482                }
     483
     484                $classes[] = 'no-js';
    484485
    485486                return array_unique( $classes );
     
    493494         * @since 1.7.0
    494495         */
    495         public function localize_scripts() {
    496         }
     496        public function localize_scripts() {}
    497497
    498498        /**
  • branches/12.0/src/bp-templates/bp-nouveau/buddypress-functions.php

    r13710 r14204  
    221221                remove_action( 'bp_enqueue_community_scripts', 'bp_core_confirmation_js' );
    222222
    223                 /** This filter is documented in bp-core/bp-core-dependency.php */
    224                 if ( is_buddypress() || ! apply_filters( 'bp_enqueue_assets_in_bp_pages_only', true ) ) {
    225                         // Body no-js class.
    226                         add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
    227                 }
     223                // Body no-js class.
     224                add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
    228225
    229226                // Ajax querystring.
     
    472469         * @since 3.0.0
    473470         *
    474          * @param array $classes Array of classes to append to body tag.
    475          *
    476          * @return array $classes
     471         * @param string[] $classes Array of classes to append to body tag.
     472         * @return string[]
    477473         */
    478474        public function add_nojs_body_class( $classes ) {
     475                /** This filter is documented in bp-core/bp-core-dependency.php */
     476                if ( ! is_buddypress() || apply_filters( 'bp_enqueue_assets_in_bp_pages_only', true ) ) {
     477                        return $classes;
     478                }
     479
    479480                $classes[] = 'no-js';
     481
    480482                return array_unique( $classes );
    481483        }
Note: See TracChangeset for help on using the changeset viewer.