[Resolved] Buddypress featured members – adding random users

  • Participant
    Jones on #20104


    Can you help we are using the buddypress featured plugin and we want to order of the featured members to be random but we dont know how, can you help as at present the order of the featured members is alphabetical order and we want the order to be random

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2545
    Ravi on #20105

    Hello Jones,

    Thank you for using the plugin. Please try the following code in your bp-custom.php file and let me know if it works or not.

    function buddydev_filter_featured_members_type( $args ) {
    	if ( ! function_exists( 'bp_featured_members' ) ) {
    	// our scope must be featured.
    	if ( bp_featured_members()->in_the_loop() || ( isset( $args['scope'] ) && $args['scope'] == 'featured' ) ) {
    		$args['type'] = 'random';
    	return $args;
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_filter_featured_members_type' );

    Thank You

    • This reply was modified 4 years ago by Ravi.
  • Participant
    Level: Master
    Posts: 171
    JohnnyNW on #26719

    Yes, it works great! Thanks for the code!

You must be logged in to reply to this topic.

This topic is: resolved