Hi,
Do you guys know how you can filter the members loop randomly when limiting the number of results?With bp_has_members() you are able to set the filter to random and limit the the number of users to retrieved.
To me random means take all users and display some of them in a random order. The next time you chose random take all users again and pick some of them again (but not the same like before). And so on.
But currently with the random filter and limit result ist always shows the same users in a different order.
Its the same problem with the search plugin of Andrea Tarantini. This plugin limits the results and shows not all users found with random filter like it does with alpabetical filter.Hi Alex,
Welcome to BuddyDev.I do not see any issue with BuddyPress query and for me it is returning different results(I tried 5 times where 3 had same rows but 2 had different rows).
It is quiet possible that the result is random but the effect is only visible some of the time.
In case you are using BP Nouveau, you may use a snippet like this to enable random order for all members context
add_filter( 'bp_nouveau_get_members_filters', function ( $filters ) { $filters['random'] = __( 'Random Users' ); return $filters; } );
and test it.
If you still get exact same result all the time, you may want to check https://stackoverflow.com/questions/21187570/why-is-mysql-returning-the-same-results-while-using-rand-in-the-select-stateme
Regards
Brajesh
You must be logged in to reply to this topic.