vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   vBulletin 4 Request - Looking for a Drawing/Raffle Mod (https://vborg.vbsupport.ru/showthread.php?t=324307)

MrFurious 01-27-2017 08:57 PM

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

scottkoz20 01-28-2017 02:23 AM

this might be useful for you

https://vborg.vbsupport.ru/showthrea...ghlight=raffle

MrFurious 01-28-2017 02:43 AM

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.

MarkFL 01-28-2017 03:35 AM

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
The limit of 1 will be ignored, so either just take the first name shown, or set "Results to Show Per Page" at 1. :)

MrFurious 01-28-2017 06:57 AM

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
I get this error:

Quote:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIND_IN_SET(104,membergroupids) OR FIND_IN_SET(105,membergroupids) OR FIND_IN_SE' at line 1

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
I get the following error:

Quote:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'savagesh_vBull_CMS_Prod.user' doesn't exist
Like I said, I'm not a programmer. :confused: MySQL version is 5.5.52-cll if that matters any.

MarkFL 01-28-2017 07:14 AM

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".

TheAdminMarket 01-28-2017 10:12 AM

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()");


All times are GMT. The time now is 07:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01080 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete