Log in

View Full Version : Is there a user chooser mod/plugin?


Wild Bronco
05-31-2009, 10:59 AM
I don't know if this is the right place to ask, but it did not fit anywhare else...

I am having a game on my site and need to pull out 3 random usernames who have registered in Mai.

Is there a mod/plugin for this ??

Lynne
05-31-2009, 05:38 PM
I have not seen a mod for this.

Wild Bronco
06-01-2009, 10:50 PM
It would be nice to have this in/for vBulletin

But I solved it by using http://random.org/

By using User ID's I could make a random draw :)

SamirDarji
03-23-2011, 05:03 AM
I'm looking for almost exactly the same thing. Except I want to choose from the active users in a given month. I don't need anything fancy, just the sql query. But I don't know how to construct those. :(

Any assistance appreciated.

Lynne
03-23-2011, 04:10 PM
Getting active users in a given month is going to be more difficult than getting registered users. Registration dates are kept; dates a user logged in are not. You will need to set up a database/field/something to actually log all times a user is logged in if you wish to find when they were active.

SamirDarji
03-23-2011, 04:49 PM
Isn't there a last login date? And if the query (or manually if I have to) can determine the number of days in the current month, then it could check the number of days between the last login date and the current date and if it doesn't exceed the number of days in the month, it's a valid user.

Then take all these valid users and pull a random one. Is there not a way?

Lynne
03-23-2011, 05:11 PM
But if you are looking for anybody who was active in the month of February, someone could come log in right now, and not have been online since last year, and that means their last login date would be March, but they were definitely not an active user in February.

SamirDarji
03-23-2011, 05:40 PM
True, but that's why I was going to run the query at the end of each month on the last day. Either via a cron or manually.

Lynne
03-23-2011, 05:44 PM
Then that would work. You hadn't said that before which is why I couldn't see how that would work. :)

SamirDarji
03-23-2011, 06:02 PM
Sorry. :( I didn't know if there was a way to make it work outside of the current month or not.

Now I just need the db query. :)

Lynne
03-23-2011, 09:05 PM
Something like:
SELECT count(*) as count FROM user WHERE lastvisit > xxxxxxxx

I'm a trial and error query writer, so I'm sure you'll have to play with that.

SamirDarji
03-24-2011, 01:09 AM
Thank you! It's a start. It's a little like the blind leading the blind, but so appreciated!

MoMan
03-24-2011, 05:52 AM
There's a mod called usermodlog which logs every login. Based on that data, you could easily find users based on more specific activity.

SamirDarji
03-24-2011, 06:39 AM
I searched and found it. It's a lot more than what I need. :(

DragonByte Tech was kind enough to quickly hammer out a script that does the job:
https://vborg.vbsupport.ru/showpost.php?p=2176862&postcount=81