We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Show random users in the members/users block on homepage | Forum

fbkca
fbkca Nov 12 '13
Hi, 


Currently there are ways to show latest, online and featured users, however is there anyway to display random users?


Any advise would be great.


Thanks


Paul

Daisy Team
Daisy Nov 20 '13
Could you please specify what do you mean by 'random users'? What algorithm of users randomization should be used?
fbkca
fbkca Nov 21 '13
umm...  just display a random selection of users from your site... not sure how else to explain that. not sure what algorithm... probably just use MySQL's  RAND function???


SELECT * FROM ow_base_users ORDER BY RAND() LIMIT 12; etc... 

Daisy Team
Daisy Nov 25 '13
We do not recommend to use the RAND function because if you have a lot of users, this function will extremely slow down your site performance. The best way to achieve this is creating the script with the definite algorithm by which the system will select the users and show them in the random list.

Anyway, you can easily create a new users list using the existing lists. You can see how it works in /ow_system_plugins/base/controllers/user_list.php file.
fbkca
fbkca Nov 26 '13
Thanks I'll look into that. I didn't seem to have a problem with in using this method in my previous system and 45k users...


What's a lot of user's in your mind?

Daisy Team
Daisy Nov 27 '13
Hmm, 45k it's quite huge community. We do not insist that you shouldn't use the RAND(), but we must advise about the negative consequences.  As I said, you can check the existing profiles lists to see how it works and how to add an additional list, but it's up to you to choose what functions and scripts use.

If you have further questions or concerns, feel free to ask us.