LLMS_Student_Query::preprare_query()
Prepare the SQL for the query.
Contents
Return Return
(string)
Source Source
File: includes/class.llms.student.query.php
*/
protected function prepare_query() {
global $wpdb;
$vars = array();
if ( $this->get( 'search' ) ) {
$search = '%' . $wpdb->esc_like( $this->get( 'search' ) ) . '%';
$vars[] = $search;
$vars[] = $search;
$vars[] = $search;
}
$vars[] = $this->get_skip();
$vars[] = $this->get( 'per_page' );
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- $vars is an array with the correct number of items.
$sql = $wpdb->prepare(
"SELECT {$this->sql_select()}
FROM {$wpdb->users} AS u
{$this->sql_joins()}
{$this->sql_search()}
{$this->sql_having()}
{$this->sql_orderby()}
LIMIT %d, %d;",
$vars
);
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
return $sql;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.10.2 | Demands to $this->sql_select() to determine whether or not SQL_CALC_FOUND_ROWS statement is needed. |
| 3.4.0 | |
| 3.13.0 | Introduced. |