bbp_register_view( string $view, string $title, mixed $query_args = '', bool $feed = true, string $capability = '' )
Register a Forums view
Description
Parameters
- $view
-
(string) (Required) View name
- $title
-
(string) (Required) View title
- $query_args
-
(mixed) (Optional) bbp_has_topics() arguments.
Default value: ''
- $feed
-
(bool) (Optional) Have a feed for the view? Defaults to true. NOT IMPLEMENTED
Default value: true
- $capability
-
(string) (Optional) Capability that the current user must have
Default value: ''
Return
(array) The just registered (but processed) view
Source
File: bp-forums/core/functions.php
function bbp_register_view( $view, $title, $query_args = '', $feed = true, $capability = '' ) { // Bail if user does not have capability if ( ! empty( $capability ) && ! current_user_can( $capability ) ) return false; $bbp = bbpress(); $view = sanitize_title( $view ); $title = esc_html( $title ); if ( empty( $view ) || empty( $title ) ) return false; $query_args = bbp_parse_args( $query_args, '', 'register_view' ); // Set show_stickies to false if it wasn't supplied if ( !isset( $query_args['show_stickies'] ) ) $query_args['show_stickies'] = false; $bbp->views[$view] = array( 'title' => $title, 'query' => $query_args, 'feed' => $feed ); return $bbp->views[$view]; }
Changelog
Version | Description |
---|---|
bbPress (r2789) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.