![]() |
auto update usergroup
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! |
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:
|
Quote:
PHP Code:
|
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 ;) |
Aha! Thank you very much. :):):):):)
|
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:
|
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!
|
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!
|
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 |
Thank you very much, Xenon. :)
|
You're welcome
|
Can you have a Default Auto PM or email sent when the user gets upgraded to the new usergroup?
Thanks |
all you have to do, is to insert a new row into the privatemessage table :)
|
All times are GMT. The time now is 03:55 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|