bp_maybe_load_mentions_scripts_for_blog_content

Should BuddyPress load the mentions scripts and related assets, including results to prime the mentions suggestions?.

Description

bp_maybe_load_mentions_scripts_for_blog_content( (bool) $load_mentions, (bool) $mentions_enabled ); 

Parameters (2)

0. $load_mentions (bool)
True to load mentions assets, false otherwise.
1. $mentions_enabled (bool)
True if mentions are enabled.

Usage

  1. if ( !function_exists( 'bp_maybe_load_mentions_scripts_for_blog_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-filters.php'; 
  3.  
  4. // True to load mentions assets, false otherwise. 
  5. $load_mentions = true; 
  6.  
  7. // True if mentions are enabled. 
  8. $mentions_enabled = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_maybe_load_mentions_scripts_for_blog_content($load_mentions, $mentions_enabled); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-filters.php  
  1. function bp_maybe_load_mentions_scripts_for_blog_content( $load_mentions, $mentions_enabled ) { 
  2. if ( ! $mentions_enabled ) { 
  3. return $load_mentions; 
  4.  
  5. if ( $load_mentions || ( bp_is_blog_page() && is_singular() && comments_open() ) ) { 
  6. return true; 
  7.  
  8. return $load_mentions;