@bookchiq
10 years, 11 months ago
Replying well after the fact to help any other Google searchers who come across this page:
Add something like the following code to your theme’s functions.php file:
functions.php
add_action( 'bp_members_directory_order_options', 'bp27845_add_random_order_option' ); function bp27845_add_random_order_option() { echo '<option value="random">' . __( 'Surprise me!', 'buddypress' ) . '</option>'; } // end bp27845_add_random_order_option
This code takes advantage of the bp_members_directory_order_options action hook to insert a new option, which then sets bp_has_members()‘s type to random (the value we’re sending).
bp_members_directory_order_options
bp_has_members()
type
random
A more in-depth tutorial: https://codex.buddypress.org/plugindev/add-custom-filters-to-loops-and-enjoy-them-within-your-plugin/#add-a-custom-filter-to-the-members-groups-and-blogs-loops