bp_get_forum_pagination_count

Return the pagination count for the current topic list.

Description

(string) bp_get_forum_pagination_count(); 

The count is a string of the form Viewing x of y topics..

Returns (string)


Usage

  1. if ( !function_exists( 'bp_get_forum_pagination_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_forum_pagination_count(); 
  7.  

Defined (1)

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

/bp-forums/bp-forums-template.php  
  1. function bp_get_forum_pagination_count() { 
  2. global $forum_template; 
  3.  
  4. $start_num = intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1; 
  5. $from_num = bp_core_number_format( $start_num ); 
  6. $to_num = bp_core_number_format( ( $start_num + ( $forum_template->pag_num - 1 ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $start_num + ( $forum_template->pag_num - 1 ) ); 
  7. $total = bp_core_number_format( $forum_template->total_topic_count ); 
  8. $pag_filter = false; 
  9.  
  10. if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) ) 
  11. $pag_filter = sprintf( __( ' matching tag "%s"', buddypress ), $forum_template->search_terms ); 
  12.  
  13. if ( 1 == $forum_template->total_topic_count ) { 
  14. $message = __( 'Viewing 1 topic', buddypress ); 
  15. } else { 
  16. $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s topic', 'Viewing %1$s - %2$s of %3$s topics', (int) $forum_template->total_topic_count, buddypress ), $from_num, $to_num, $total, $pag_filter ); 
  17.  
  18. /** 
  19. * Filters the pagination count for the current topic list. 
  20. * @since 1.5.0 
  21. * @param string $message Pagination count for the current topic list. 
  22. * @param string $from_num Low end count in the view. 
  23. * @param string $to_num High end count in the view. 
  24. * @param string $total Total count of topics found. 
  25. */ 
  26. return apply_filters( 'bp_get_forum_pagination_count', $message, $from_num, $to_num, $total );