The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
The SQL query you want is this:
UPDATE `user` SET `usergroupid` = '#' WHERE `userid` =x LIMIT 1 ; # should be set to whatever usergroupid you want the person to be in x = the user id of the member being promoted I hope this is right |
#12
|
|||
|
|||
Ok using that info this is the php line I came up with:
PHP Code:
anyways, this just doesnt work, this is the error I keep getting.. Fatal error: Call to a member function on a non-object on line 37 |
#13
|
|||
|
|||
Try this.
Code:
$db_select = @mysql_select_db($dbname,$db) or die('Mysql Database Failure'); $table_name = 'user'; $result = mysql_query("UPDATE '.$table_name.' SET usergroupid = '9' WHERE userid = '" . $username . "' LIMIT 1") or die(mysql_error()); Sorry for the delay. I had to look that up on php.net I only usually do databases, not PHP. Let me know if it works |
#14
|
|||
|
|||
Interesting.. well now it atleast gives me this as output
"Mysql Database Failure" so atleast your new code is doing something. I wonder what the issue is, I will tinker. |
#15
|
|||
|
|||
Ok that means its not connecting to the DB.
Try removing the $db_select line and tell me what it says |
#16
|
|||
|
|||
UPDATE!!! SUCCESS!!! I removed ure previous code for conneting the database and thats why it didnt work, as soon as I put that code back in, it seems to now conenct to the database and made the neccesary change in the usergroup permissions!! this is awesome.
Thanks so much. Ok now onto the next phase of this project. Actually before I move on, does anyone know if there is another way to conenct to the database since I dont feel right putting in my database name and password into this php file, altho I guess its ok if noone knows where it is right ? |
#17
|
|||
|
|||
Yay! glad I could help a little!
You have the database details in the config.php file correct? |
#18
|
||||
|
||||
If you require() global.php, it basically "loads vBulletin". This gives you access to the database, user sessions, everything. Depending on what you are doing, you may or may not want this.
Anyway, whenever you see the database object ($db, $this->db, $vbulletin->db etc), it is going through vBulletin instead of just through MySQL. PHP Code:
My query is essentially the same, too. I added the constant TABLE_PREFIX before the table name, which is pretty much the standard now so it will work no matter what your prefix is (or isn't). There is no need to put 9 in quotes, as it is an integer. Unless you have a list of userids, you can simply check if left side = right side. |
#19
|
|||
|
|||
Aha. I was wondering what all the $db, $this->db, $vbulletin->db etc malarky was
|
#20
|
|||
|
|||
Ah-ha. Yes so it can be done using vbulletins own variables. Wow we have 2 equally great solutions in one thread, will be great for ppl looking in at this thread in the future using search. Ok, now to Step 4, coding the opposite.. The demotions
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|