BBP_Default::mentions_script()

Enqueue @mentions JS.

Description

Source

File: bp-forums/templates/default/bbpress-functions.php

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
public function mentions_script() {
 
    // Special handling for New/Edit screens in wp-admin.
    if ( is_admin() ) {
        if (
            ! get_current_screen() ||
            ! in_array( get_current_screen()->base, array( 'page', 'post' ) ) ||
            ! post_type_supports( get_current_screen()->post_type, 'editor' ) ) {
            return;
        }
    }
 
    $min = bp_core_get_minified_asset_suffix();
 
    if ( ! wp_script_is( 'bp-mentions' ) ) {
        wp_enqueue_script( 'bp-mentions', buddypress()->plugin_url . "bp-core/js/mentions{$min}.js", array(
            'jquery',
            'jquery-atwho'
        ), bp_get_version(), true );
        wp_enqueue_style( 'bp-mentions-css', buddypress()->plugin_url . "bp-core/css/mentions{$min}.css", array(), bp_get_version() );
 
        wp_style_add_data( 'bp-mentions-css', 'rtl', true );
        if ( $min ) {
            wp_style_add_data( 'bp-mentions-css', 'suffix', $min );
        }
 
        wp_localize_script( 'bp-mentions', 'BP_Mentions_Options', bp_at_mention_default_options() );
 
        /**
         * Fires at the end of the Mentions script.
         *
         * This is the hook where BP components can add their own prefetched results
         * friends to the page for quicker @mentions lookups.
         *
         * @since BuddyBoss 1.2.8
         */
        do_action( 'bbp_forums_mentions_prime_results' );
    }
}

Changelog

Changelog
Version Description
BuddyBoss 1.2.8 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.