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_Student_Query::sql_joins()

Setup joins based on submitted sort and search args


Return Return

(string)


Top ↑

Source Source

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

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
private function sql_joins() {
 
    global $wpdb;
 
    $joins = array();
 
    $fields = array(
        'first_name'       => "JOIN {$wpdb->usermeta} AS m_first ON u.ID = m_first.user_id AND m_first.meta_key = 'first_name'",
        'last_name'        => "JOIN {$wpdb->usermeta} AS m_last ON u.ID = m_last.user_id AND m_last.meta_key = 'last_name'",
        'overall_progress' => "JOIN {$wpdb->usermeta} AS m_o_p ON u.ID = m_o_p.user_id AND m_o_p.meta_key = 'llms_overall_progress'",
        'overall_grade'    => "JOIN {$wpdb->usermeta} AS m_o_g ON u.ID = m_o_g.user_id AND m_o_g.meta_key = 'llms_overall_grade'",
    );
 
    // Add the fields to the array of fields to select.
    foreach ( $fields as $key => $statement ) {
        if ( $this->requires_field( $key ) ) {
            $joins[] = $statement;
        }
    }
 
    $sql = implode( ' ', $joins );
 
    if ( $this->get( 'suppress_filters' ) ) {
        return $sql;
    }
 
    /**
     * Filters the query JOIN clause
     *
     * @since 3.13.0
     *
     * @param string             $sql           The JOIN clause of the query.
     * @param LLMS_Student_Query $student_query Instance of LLMS_Student_Query.
     */
    return apply_filters( 'llms_student_query_join', $sql, $this );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.10.2 Drop usage of this->get_filter( 'join' ) in favor of 'llms_student_query_join'.
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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