buddypress directory default alpha last name sort code example

Example: buddypress directory default alpha last name sort

//To order alphabetically user the bp_nouveau_get_members_filters.

function themename_bp_reorder_member_directory_filters( $filters, $context ) {
	if ( 'group' !== $context ) {

		$filters = array();

		if ( bp_is_active( 'xprofile' ) ) {
			$filters['alphabetical'] = __( 'Alphabetical', 'buddypress' );
		}

		$filters['active'] = __( 'Last Active', 'buddypress' );
		$filters['newest'] = __( 'Newest Registered', 'buddypress' );
	}

	return $filters;
}
add_filter( 'bp_nouveau_get_members_filters', 'themename_bp_reorder_member_directory_filters', 10, 2 );

Tags:

Misc Example