BP_Date_Query

BuddyPress date query class.

Defined (1)

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

/bp-core/classes/class-bp-date-query.php  
  1. class BP_Date_Query extends WP_Date_Query { 
  2. /** 
  3. * The column to query against. Can be changed via the query arguments. 
  4. * @var string 
  5. */ 
  6. public $column; 
  7.  
  8. /** 
  9. * Constructor. 
  10. * @param array $date_query Date query arguments. 
  11. * @param string $column THe DB column to query against. 
  12. * @see WP_Date_Query::__construct() 
  13. */ 
  14. public function __construct( $date_query, $column = '' ) { 
  15. if ( ! empty( $column ) ) { 
  16. $this->column = $column; 
  17. add_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) ); 
  18.  
  19. parent::__construct( $date_query, $column ); 
  20.  
  21. /** 
  22. * Destructor. 
  23. */ 
  24. public function __destruct() { 
  25. remove_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) ); 
  26.  
  27. /** 
  28. * Registers our date column with WP Date Query to pass validation. 
  29. * @param array $retval Current DB columns. 
  30. * @return array 
  31. */ 
  32. public function register_date_column( $retval = array() ) { 
  33. $retval[] = $this->column; 
  34. return $retval;