Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Notifications_Query::sql_where()
Retrieve the prepared SQL for the WHERE clause
Return Return
(string)
Source Source
File: includes/notifications/class.llms.notifications.query.php
private function sql_where() { global $wpdb; $where = 'WHERE 1'; $post_statuses = array_merge( array( 'publish' ), array_keys( llms_get_order_statuses() ) ); $post_statuses = array_map( array( $this, 'escape_and_quote_string' ), $post_statuses ); $where .= sprintf( ' AND p.post_status IN ( %s )', implode( ', ', $post_statuses ) ); // these args are all "whered" in the same way $wheres = array( 'statuses' => 'status', 'triggers' => 'trigger_id', 'types' => 'type', ); // loop through them and build the where clauses based off the submitted data foreach ( $wheres as $arg_name => $col_name ) { $arg = $this->get( $arg_name ); if ( $arg ) { $prepped = array_map( array( $this, 'escape_and_quote_string' ), $arg ); $where .= sprintf( ' AND n.%1$s IN( %2$s )', $col_name, implode( ', ', $prepped ) ); } } // add subscriber info if set $subscriber = $this->get( 'subscriber' ); if ( $subscriber ) { $where .= $wpdb->prepare( ' AND n.subscriber = %s', $subscriber ); } // add post and user id checks foreach ( array( 'post_id', 'user_id' ) as $var ) { $arg = $this->get( $var ); if ( $arg ) { $where .= sprintf( ' AND n.%1$s = %2$d', esc_sql( $var ), absint( $arg ) ); } } return $where; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | Introduced. |