LLMS_REST_API_Keys_Query::sql_where()
SQL “where” clause for the query
Return Return
(string)
Source Source
File: libraries/lifterlms-rest/includes/class-llms-rest-api-keys-query.php
protected function sql_where() { global $wpdb; $sql = 'WHERE 1'; // "IN" clauses for id fields. $ids_include = array( 'include' => 'id', 'user' => 'user_id', ); foreach ( $ids_include as $query_key => $db_key ) { $ids = $this->get( $query_key ); if ( $ids ) { $prepared = implode( ',', $ids ); $sql .= " AND {$db_key} IN ({$prepared})"; } } // "NOT IN" clauses for id fields. $ids_exclude = array( 'exclude' => 'id', 'user_not_in' => 'user_id', ); foreach ( $ids_exclude as $query_key => $db_key ) { $ids = $this->get( $query_key ); if ( $ids ) { $prepared = implode( ',', $ids ); $sql .= " AND {$db_key} NOT IN ({$prepared})"; } } // Permission match. $permissions = $this->get( 'permissions' ); if ( $permissions ) { $sql .= $wpdb->prepare( ' AND permissions = %s', $permissions ); } if ( $this->get( 'suppress_filters' ) ) { return $sql; } /** * Filters the query WHERE clause * * @since 1.0.0-beta.1 * * @param string $sql The WHERE clause of the query. * @param LLMS_REST_API_Keys_Query $apy_keys__query Instance of LLMS_REST_API_Keys_Query. */ return apply_filters( 'llms_rest_api_key_query_where', $sql, $this ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.16 | Drop usage of $this->get_filter('where') in favor of 'llms_rest_api_key_query_where' . |
1.0.0-beta.1 | Introduced. |