The Arcive of vBulletin Modifications Site. |
|
auto update usergroup Details »»
|
|||||||||||||||||||||||||
I have used c-pr0mpt's hack to create an extra page on my site.
What I am trying to do is create a php page where a user in usergroup Y can click the submit button and automatically be upgraded to usergroup X. I already have the submit button, based on the one in the register template. I already have the php file created, just need to the query necessary to make the update automatically when the user clicks the submit button. Also, how would I go about tracking the date a member makes this upgrade? I need some way to either automatically put the user back in usergroup Y after 30 days, or way for the admin to get a list of when people in usergroup X upgraded, so he can manually move the user back to group Y. Thank you! Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
the query is just as easy:
[sql]UPDATE user SET usergroupid=X WHERE userid=yyy AND usergroupid=y[/sql] you just have to replce the variables.. the second paragraph: you need to add another field to the user-table via phpmyadmin then when runing the query above, you should add a part: ,userupgradedate=".time()." to automatically move him back to his old usergroup you can add this line at the end of your global.php: PHP Code:
|
|
#3
|
|||
|
|||
|
Quote:
PHP Code:
|
|
#4
|
||||
|
||||
|
right, this would be the php-code.
you have to replace the yyy with $bbuserinfo[userid] so the script will know which the userid is
|
|
#5
|
|||
|
|||
|
Aha! Thank you very much.
![]() ![]() ![]() ![]()
|
|
#6
|
|||
|
|||
|
I just tested this and when the user clicked the submit button I have on the page, she received a 404 error and the query didn't work. What have I done wrong? (Sorry so many questions -- this is my first "hack.")
Here is my php script: PHP Code:
|
|
#7
|
|||
|
|||
|
Oh, I also discovered that the code I added to globals.php had already started putting people in usergroup X back into usergroup Y. Argh!
|
|
#8
|
|||
|
|||
|
Wugh. One more thing occurred to me. How does one prevent someone who has already used the free trial, from trying it again after the first trial has expired...? Ack!
|
|
#9
|
||||
|
||||
|
if they get a 404 error, you have made a wrong link....
the code cannot produce a 404, but if you have misspelled a link that could appear ![]() the last question: just add an ifclause: if($bbuserinfo[userupgradedate]>0) show_nopermission(); so as long as they have never been in group 21 the datevalue would be 0 so they can access the trial, but if they were in that group the datevalue is greater than 0 so they'll get a nopermission |
|
#10
|
|||
|
|||
|
Thank you very much, Xenon.
|
![]() |
|
|