The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vBulletin 4 Request - Looking for a Drawing/Raffle Mod
I'm looking for a vb4 mod to pick random users from my database for product give-aways. I need to be able to specify what usergroup(s) are eligible for the drawing, and only select from those who have been active on the forum in a given amount of time (1 month, 6 months, 1 year, etc.)
I'm a business guy, not a programmer - so a simple plugin or mod would be best. I am savvy enough to run a SQL query via Maintenance if if I have a query I can just C&P. Never imagined it would be this much of a headache to give something away. lol |
#2
|
|||
|
|||
|
#3
|
|||
|
|||
I'm not looking for something that extensive or elaborate, I just want a simple "click the button and get a name" or "paste a query and get a result" for the oddball drawing I do now and then to give something away.
|
#4
|
||||
|
||||
Suppose you wanted to pick a user at random from usergroups 6 and 9, then you could use this query:
Code:
SELECT user.username FROM user AS user WHERE usergroupid IN (6,9) OR FIND_IN_SET(6,membergroupids) OR FIND_IN_SET(9,membergroupids) ORDER BY RAND() LIMIT 1 |
#5
|
|||
|
|||
If I use this query:
Code:
SELECT user.username FROM user AS user WHERE usergroupid IN (16,103,104,105,106) OR FIND_IN_SET(16,membergroupids) OR FIND_IN_SET(103,membergroupids) FIND_IN_SET(104,membergroupids) OR FIND_IN_SET(105,membergroupids) OR FIND_IN_SET(106,membergroupids) OR ORDER BY RAND() LIMIT 1 Quote:
Using this shortened version: Code:
SELECT user.username FROM user AS user WHERE usergroupid IN (16,103,104,105,106) ORDER BY RAND() LIMIT 1 Quote:
|
#6
|
||||
|
||||
In the first query, you have an "OR" that's misplaced. In the second, I am guessing you need to specify a table prefix before "user AS user".
|
#7
|
||||
|
||||
Code:
$this_user = $db->query_first("SELECT username FROM ".TABLE_PREFIX."user WHERE usergroupid IN (16,103,104,105,106) OR FIND_IN_SET(16,membergroupids) OR FIND_IN_SET(103,membergroupids) OR FIND_IN_SET(104,membergroupids) OR FIND_IN_SET(105,membergroupids) OR FIND_IN_SET(106,membergroupids) ORDER BY RAND()"); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|