bp_get_members_pagination_count

Generate the members pagination count.

Description

(string) bp_get_members_pagination_count(); 

Returns (string)


Usage

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

Defined (1)

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

/bp-members/bp-members-template.php  
  1. function bp_get_members_pagination_count() { 
  2. global $members_template; 
  3.  
  4. if ( empty( $members_template->type ) ) 
  5. $members_template->type = ''; 
  6.  
  7. $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1; 
  8. $from_num = bp_core_number_format( $start_num ); 
  9. $to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) ); 
  10. $total = bp_core_number_format( $members_template->total_member_count ); 
  11.  
  12. if ( 'active' == $members_template->type ) { 
  13. if ( 1 == $members_template->total_member_count ) { 
  14. $pag = __( 'Viewing 1 active member', buddypress ); 
  15. } else { 
  16. $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s active member', 'Viewing %1$s - %2$s of %3$s active members', $members_template->total_member_count, buddypress ), $from_num, $to_num, $total ); 
  17. } elseif ( 'popular' == $members_template->type ) { 
  18. if ( 1 == $members_template->total_member_count ) { 
  19. $pag = __( 'Viewing 1 member with friends', buddypress ); 
  20. } else { 
  21. $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s member with friends', 'Viewing %1$s - %2$s of %3$s members with friends', $members_template->total_member_count, buddypress ), $from_num, $to_num, $total ); 
  22. } elseif ( 'online' == $members_template->type ) { 
  23. if ( 1 == $members_template->total_member_count ) { 
  24. $pag = __( 'Viewing 1 online member', buddypress ); 
  25. } else { 
  26. $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s online member', 'Viewing %1$s - %2$s of %3$s online members', $members_template->total_member_count, buddypress ), $from_num, $to_num, $total ); 
  27. } else { 
  28. if ( 1 == $members_template->total_member_count ) { 
  29. $pag = __( 'Viewing 1 member', buddypress ); 
  30. } else { 
  31. $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s members', $members_template->total_member_count, buddypress ), $from_num, $to_num, $total ); 
  32.  
  33. /** 
  34. * Filters the members pagination count. 
  35. * @since 1.5.0 
  36. * @param string $pag Pagination count string. 
  37. */