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 12-01-2002, 04:12 PM
KingsGambit KingsGambit is offline
 
Join Date: Oct 2002
Location: London, England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Auto usergroup change?

To all other hackers out there, any ideas?
I've implemented a points system for users who post replies in a particular forum (newbie help forum).
Added an extra field into user table for "points" and have said in newreply.php that IF user posts a reply and is NOT thread starter THEN user's points = points + 2.
This works absolutely fine. What I want to know if anyone can help with is if it's possible to trigger a usergroupid change when user reaches x points.
eg. IF user points = x AND usergroupid = new member THEN usergroupid = full member.
Has anyone already got something like that? I'm almost positive I've got the correct syntax in the php file but it doesn't work. Points works fine, usergroupid doesn't change. Any help appreciated.
Reply With Quote
  #2  
Old 12-01-2002, 05:58 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you post what code you tried to use

Satan
Reply With Quote
  #3  
Old 12-01-2002, 07:32 PM
KingsGambit KingsGambit is offline
 
Join Date: Oct 2002
Location: London, England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ummm....hehe...my bad.

The points are added with the following code in newreply.php:

Quote:
$DB_site->query("UPDATE user SET
".iif (($forumid==19) and (!$bbuserinfo[userid]==$threadinfo[postuserid]),"rating=rating+2,","")."
$dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");
IF forum is 19 and poster is NOT thread starter, add 2 to rating

I was trying using similar code to do the change of usergroups:

Quote:
$DB_site->query("UPDATE user SET
".iif (($bbuserinfo[rating]==20) and ($bbuserinfo[usergroupid]==2),"usergroupid=10,","")."
$dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");
IF users rating IS 20 AND user is noob THEN change usergroup to full member

It's a little messy, and it doesn't need to also set the last post bits, but putting it here means that on the 10th reply when rating=20 I was hoping usergroupid would change from 2 to 10 automatically to open up an extra forum for example, different user title, etc. I'm doing something completely wrong aren't I? It's blatantly obvious isn't it? Hehe.
Reply With Quote
  #4  
Old 12-03-2002, 10:55 AM
KingsGambit KingsGambit is offline
 
Join Date: Oct 2002
Location: London, England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is bumping allowed? Ahem...
Anybody, any ideas? Someone? Pwetty pwease?
Reply With Quote
  #5  
Old 12-03-2002, 03:52 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, the code looks ok, are you sure ratings reach 20 before this query runs?
Reply With Quote
  #6  
Old 12-03-2002, 09:39 PM
KingsGambit KingsGambit is offline
 
Join Date: Oct 2002
Location: London, England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was trying this on a test board and kept posting to test this. rating increases by two each time correctly, however the usergroupdid change doesn't trigger.
Reply With Quote
  #7  
Old 12-04-2002, 11:29 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

are you sure the query is reached?
also surely posting with usergroup 2?

take out the seond query and instead of the first one try this:

PHP Code:
$DB_site->query("UPDATE user SET " 
         
iif($forumid == 19 and !$bbuserinfo['userid'] == $threadinfo['postuserid']), iif($bbuserinfo['rating'] >= 18 and $bbuserinfo['usergroupid'] == 2"usergroupid=10,""") . "rating=rating+2,""") . 
         
$dotitle "lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'"); 
Reply With Quote
  #8  
Old 12-04-2002, 05:59 PM
KingsGambit KingsGambit is offline
 
Join Date: Oct 2002
Location: London, England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh my, that code worked. I've since taken it a few steps further into a great automated hack. I'm not sure I understand why the code I tried first didn't evaluate, but the second with two iif statements did the job. Now a new registered member can make x posts and then get *upgraded* automatically to a different usergroup. Top stuff.
errrrr..I posted another help request in the unfinished forum before I realised this one was here. Hmmm...maybe if I sneak in and distract the "Help me Finish" mod while you go and nab my thread from there....
Thanks a lot Xenon, worked a treat.
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 01:36 PM.


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.04252 seconds
  • Memory Usage 2,231KB
  • 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
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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