BP_Groups_Group::convert_type_to_order_orderby( string $type = '' )

Convert the ‘type’ parameter to ‘order’ and ‘orderby’.

Description

Parameters

$type

(string) (Optional) The 'type' shorthand param.

Default value: ''

Return

(array)

  • 'order'
    (string) SQL-friendly order string.
  • 'orderby'
    (string) SQL-friendly orderby column name.

Source

File: bp-groups/classes/class-bp-groups-group.php

	protected static function convert_type_to_order_orderby( $type = '' ) {
		$order = $orderby = '';

		switch ( $type ) {
			case 'newest' :
				$order   = 'DESC';
				$orderby = 'date_created';
				break;

			case 'active' :
				$order   = 'DESC';
				$orderby = 'last_activity';
				break;

			case 'popular' :
				$order   = 'DESC';
				$orderby = 'total_member_count';
				break;

			case 'alphabetical' :
				$order   = 'ASC';
				$orderby = 'name';
				break;

			case 'random' :
				$order   = '';
				$orderby = 'random';
				break;
		}

		return array( 'order' => $order, 'orderby' => $orderby );
	}

Changelog

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.