LLMS_Student_Query::preprare_query()

Prepare the SQL for the query.


Return Return

(string)


Top ↑

Source Source

File: includes/class.llms.student.query.php

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
*/
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;

Top ↑

Changelog 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.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.