BBP_Default::mentions_script()
Enqueue @mentions JS.
Description
Source
File: bp-forums/templates/default/bbpress-functions.php
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
| 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.