BuddyDev

Search

Buddypress featured members – adding random users


  • Participant
    Jones on #20104

    Hi

    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: Guru
    (BuddyDev Team)
    Posts: 600
    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' ) ) {
    		$args;
    	}
    
    	// 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
    Ravi

    • This reply was modified 2 months, 1 week ago by  Ravi.

You must be logged in to reply to this topic.

This topic is: not resolved
Subscribe