BP_Invitation::get_order_by_sql( array $args = array() )
Assemble the ORDER BY clause of a get() SQL statement.
Description Description
Used by BP_Invitation::get() to create its ORDER BY clause.
Parameters Parameters
- $args
-
(Optional) See BP_Invitation::get() for more details.
Default value: array()
Return Return
(string) ORDER BY clause.
Source Source
File: bp-core/classes/class-bp-invitation.php
protected static function get_order_by_sql( $args = array() ) {
// Setup local variable
$conditions = array();
$retval = '';
// Order by
if ( ! empty( $args['order_by'] ) ) {
$order_by = implode( ', ', (array) $args['order_by'] );
$conditions['order_by'] = "{$order_by}";
}
// Sort order direction
if ( ! empty( $args['sort_order'] ) ) {
$sort_order = bp_esc_sql_order( $args['sort_order'] );
$conditions['sort_order'] = "{$sort_order}";
}
// Custom ORDER BY
if ( ! empty( $conditions ) ) {
$retval = 'ORDER BY ' . implode( ' ', $conditions );
}
return $retval;
}
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |