vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Auto usergroup change? (https://vborg.vbsupport.ru/showthread.php?t=46272)

KingsGambit 12-01-2002 04:12 PM

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.

Chris M 12-01-2002 05:58 PM

Could you post what code you tried to use;)

Satan

KingsGambit 12-01-2002 07:32 PM

Ummm....hehe...my bad. :D

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. :)

KingsGambit 12-03-2002 10:55 AM

Is bumping allowed? :D Ahem...
Anybody, any ideas? Someone? Pwetty pwease?

Xenon 12-03-2002 03:52 PM

hmm, the code looks ok, are you sure ratings reach 20 before this query runs?

KingsGambit 12-03-2002 09:39 PM

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. :(

Xenon 12-04-2002 11:29 AM

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]'"); 


KingsGambit 12-04-2002 05:59 PM

Oh my, that code worked. I've since taken it a few steps further into a great automated hack. :D 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.


All times are GMT. The time now is 10:10 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.01062 seconds
  • Memory Usage 1,735KB
  • 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
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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