bb_forums

The BuddyPress bb forums function.

Description

&bb_forums( (string) $args = '' ); 

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Usage

  1. if ( !function_exists( 'bb_forums' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The args. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_forums($args); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function &bb_forums( $args = '' ) { 
  2. global $bb_forums_loop; 
  3.  
  4. $_args = func_get_args(); 
  5. $default_type = 'flat'; 
  6.  
  7. if ( is_numeric($args) ) { 
  8. $args = array( 'child_of' => $args ); 
  9. } elseif ( func_num_args() > 1 ) { // bb_forums( 'ul', $args ); Deprecated 
  10. $default_type = $args; 
  11. $args = $_args[1]; 
  12. } elseif ( $args && is_string($args) && false === strpos($args, '=') ) { 
  13. $args = array( 'type' => $args ); 
  14.  
  15. // hierarchical not used here. Sent to bb_get_forums for proper ordering. 
  16. $args = wp_parse_args( $args, array('hierarchical' => true, 'type' => $default_type, walker => 'BB_Walker_Blank') ); 
  17.  
  18. $levels = array( '', '' ); 
  19.  
  20. if ( in_array($args['type'], array('list', 'ul')) ) 
  21. $levels = array( '<ul>', '</ul>' ); 
  22.  
  23. $forums = bb_get_forums( $args ); 
  24.  
  25. if ( !class_exists($args[walker]) ) 
  26. $args[walker] = 'BB_Walker_Blank'; 
  27.  
  28. if ( $bb_forums_loop = BB_Loop::start( $forums, $args[walker] ) ) { 
  29. $bb_forums_loop->preserve( array('forum', 'forum_id') ); 
  30. $bb_forums_loop->walker->db_fields = array( 'id' => 'forum_id', 'parent' => 'forum_parent' ); 
  31. list($bb_forums_loop->walker->start_lvl, $bb_forums_loop->walker->end_lvl) = $levels; 
  32. return $bb_forums_loop->elements; 
  33. $false = false; 
  34. return $false;