bp_forums_template_topics

Filters the forums template topics.

Description

apply_filters( 'bp_forums_template_topics', (array) $this_topics, (string) $type, (int) $forum_id, (int) $per_page, (int) $max, (string) $no_stickies ); 

Parameters (6)

0. $this_topics (array)
Array of topics being set for display.
1. $type (string)
The sort order/kind. newest,, popular., unreplied, tags.
2. $forum_id (int)
ID for the current forum.
3. $per_page (int)
The number of the page being requested.
4. $max (int)
The max number of posts to show.
5. $no_stickies (string)
Requested sticky format.

Usage

To run the hook, copy the example below.
  1. $this_topics = apply_filters( 'bp_forums_template_topics', $this_topics, $type, $forum_id, $per_page, $max, $no_stickies ); 
  2.  
  3. if ( !empty( $this_topics ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_forums_template_topics callback 
  2. function filter_bp_forums_template_topics( $this_topics, $type, $forum_id, $per_page, $max, $no_stickies ) { 
  3. // make filter magic happen here... 
  4. return $this_topics
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_forums_template_topics', 'filter_bp_forums_template_topics', 10, 6 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_forums_template_topics', 'filter_bp_forums_template_topics', 10, 6 ); 

Defined (1)

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

/bp-forums/bp-forums-template.php  
  1. $this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );