bp_get_forum_name

Return the name of a given forum.

Description

(string|bool) bp_get_forum_name( (int) $forum_id = 0 ); 

Returns (string|bool)

False on failure, a name on success.

Parameters (1)

0. $forum_id — Optional. (int)
Defaults to the current forum, if there is one.

Usage

  1. if ( !function_exists( 'bp_get_forum_name' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-template.php'; 
  3.  
  4. // Optional. Defaults to the current forum, if 
  5. // there is one. 
  6. $forum_id = -1; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_get_forum_name($forum_id); 
  10.  

Defined (1)

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

/bp-forums/bp-forums-template.php  
  1. function bp_get_forum_name( $forum_id = 0 ) { 
  2.  
  3. if ( empty( $forum_id ) ) { 
  4. global $topic_template; 
  5. if ( isset( $topic_template->forum_id ) ) 
  6. $forum_id = $topic_template->forum_id; 
  7.  
  8. if ( $forum = bp_forums_get_forum( $forum_id ) ) { 
  9.  
  10. /** 
  11. * Filters the name of a given forum. 
  12. * @since 1.5.0 
  13. * @param string $forum_name Name of the given forum. 
  14. * @param string $forum_id ID of the given forum. 
  15. */ 
  16. return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id ); 
  17. } else { 
  18. return false;