Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-27-2017, 08:57 PM
MrFurious MrFurious is offline
 
Join Date: Sep 2010
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-28-2017, 02:23 AM
scottkoz20 scottkoz20 is offline
 
Join Date: Dec 2015
Location: Lewiston, NY
Posts: 344
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this might be useful for you

https://vborg.vbsupport.ru/showthrea...ghlight=raffle
Reply With Quote
  #3  
Old 01-28-2017, 02:43 AM
MrFurious MrFurious is offline
 
Join Date: Sep 2010
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 01-28-2017, 03:35 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-28-2017, 06:57 AM
MrFurious MrFurious is offline
 
Join Date: Sep 2010
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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. MySQL version is 5.5.52-cll if that matters any.
Reply With Quote
  #6  
Old 01-28-2017, 07:14 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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".
Reply With Quote
  #7  
Old 01-28-2017, 10:12 AM
TheAdminMarket's Avatar
TheAdminMarket TheAdminMarket is offline
 
Join Date: Jun 2013
Location: Thessaloniki, Greece
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:34 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.04626 seconds
  • Memory Usage 2,218KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete