bp_get_forum_permalink

Return the permalink to a given forum.

Description

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

Returns (string|bool)

False on failure, a URL 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_permalink' ) ) { 
  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_permalink($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_permalink( $forum_id = 0 ) { 
  2.  
  3. } else { 
  4. if ( empty( $forum_id ) ) { 
  5. global $topic_template; 
  6. if ( isset( $topic_template->forum_id ) ) 
  7. $forum_id = $topic_template->forum_id; 
  8.  
  9. if ( $forum = bp_forums_get_forum( $forum_id ) ) 
  10. $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug ); 
  11. else 
  12. return false; 
  13.  
  14. /** 
  15. * Filters the permalink to a given forum. 
  16. * @since 1.0.0 
  17. * @param string $value Peramlink to the given forum. 
  18. */