BP_Groups_Group::convert_orderby_to_order_by_term( string $orderby )
Convert the ‘orderby’ param into a proper SQL term/column.
Description
Parameters
- $orderby
-
(Required) Orderby term as passed to get().
Return
(string) $order_by_term SQL-friendly orderby term.
Source
File: bp-groups/classes/class-bp-groups-group.php
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 | protected static function convert_orderby_to_order_by_term( $orderby ) { $order_by_term = '' ; switch ( $orderby ) { case 'date_created' : default : $order_by_term = 'g.date_created' ; break ; case 'last_activity' : $order_by_term = 'gm_last_activity.meta_value' ; break ; case 'total_member_count' : $order_by_term = 'CONVERT(gm_total_member_count.meta_value, SIGNED)' ; break ; case 'name' : $order_by_term = 'g.name' ; break ; case 'random' : $order_by_term = 'rand()' ; break ; case 'meta_id' : $order_by_term = buddypress()->groups->table_name_groupmeta . '.id' ; break ; } return $order_by_term ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.8.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.