bp_activity_total_activities_sql

Filters the total activities MySQL statement.

Description

apply_filters( 'bp_activity_total_activities_sql', (string) $select_count_distinct_a_id_from_bp_activity_table_name_a_join_sql_where_sql, (string) $where_sql, (string) $sort ); 

Parameters (3)

0. $select_count_distinct_a_id_from_bp_activity_table_name_a_join_sql_where_sql (string) => "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}"
The select count distinct a id from bp activity table name a join sql where sql.
1. $where_sql (string)
MySQL WHERE statement portion.
2. $sort (string)
Sort direction for query.

Usage

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

Defined (1)

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

/bp-activity/classes/class-bp-activity-activity.php  
  1. $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );