bb_register_view

The BuddyPress bb register view function.

Description

bb_register_view( $view, $title, (string) $query_args = '', (bool) $feed = true ); 

Parameters (4)

0. $view
The view.
1. $title
The title.
2. $query_args — Optional. (string) => ''
The query args.
3. $feed — Optional. (bool) => true
The feed.

Usage

  1. if ( !function_exists( 'bb_register_view' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The view. 
  5. $view = null; 
  6.  
  7. // The title. 
  8. $title = null; 
  9.  
  10. // The query args. 
  11. $query_args = ''; 
  12.  
  13. // The feed. 
  14. $feed = true; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bb_register_view($view, $title, $query_args, $feed); 
  18.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_register_view( $view, $title, $query_args = '', $feed = TRUE ) { 
  2. global $bb_views; 
  3.  
  4. $view = bb_slug_sanitize( $view ); 
  5. $title = esc_html( $title ); 
  6.  
  7. if ( !$view || !$title ) 
  8. return false; 
  9.  
  10. $query_args = wp_parse_args( $query_args ); 
  11.  
  12. if ( !$sticky_set = isset($query_args['sticky']) ) 
  13. $query_args['sticky'] = 'no'; 
  14.  
  15. $bb_views[$view]['title'] = $title; 
  16. $bb_views[$view]['query'] = $query_args; 
  17. $bb_views[$view]['sticky'] = !$sticky_set; // No sticky set => split into stickies and not 
  18. $bb_views[$view]['feed'] = $feed; 
  19. return $bb_views[$view];