bp_forums_add_replied_where_sql

Filter the get_topics_where portion of the Forums sql when on a user's Replied To page.

Description

(string) bp_forums_add_replied_where_sql( (string) $sql ); 

This filter is added in bp_has_forum_topics().

Returns (string)

$sql SQL fragment.

Parameters (1)

0. $sql (string)
SQL fragment.

Usage

  1. if ( !function_exists( 'bp_forums_add_replied_where_sql' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-filters.php'; 
  3.  
  4. // SQL fragment. 
  5. $sql = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_forums_add_replied_where_sql($sql); 
  9.  

Defined (1)

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

/bp-forums/bp-forums-filters.php  
  1. function bp_forums_add_replied_where_sql( $sql ) { 
  2. global $wpdb; 
  3.  
  4. $sql .= $wpdb->prepare( " AND p.poster_id = %s ", bp_displayed_user_id() ); 
  5.  
  6. // Remove any topic_author information. 
  7. $sql = str_replace( " AND t.topic_poster = '" . bp_displayed_user_id() . "'", '', $sql ); 
  8.  
  9. return $sql;