![]() |
Write to $vbulletin->userinfo
Hey,
I can use $vbulletin->userinfo in a PHP script to read/return a specific value of a field. But what's the command for writing to a specific field? |
Writing to it how?
|
just add a column to the user database table
then you can access that column with the $vbulletin->userinfo array |
I dont want to access/read from it. I want to write to it through the PHP script and I need to know which vB command should be used for that.
Example (reading): if (is_member_of($vbulletin->userinfo, 6)) checks if the user is in user group ID of 6. Let's say I want to set the ID for this user instead of reading it, how can this be done? |
You want to update the users usergroupid? in the database, or on the page load?
|
The groupID was just an example. I want to edit an entry in the user database in a PHP script I'm calling outside of the forum itself (through a program).
|
If you want to edit and entry *in the database*, then you need to do a query like this (example to set userid to 10 for a user who's username is JoeBlow:
PHP Code:
http://www.vbulletin.com/docs/html/c...ards_sql_query (I would NOT change the userids via a query. If you accidentally set the userid to the same as another user, you can really mess things up!) |
Of course, the userID was just an example. I've added a custom column for all users which I want edit so the original vB entries stay untouched.
//edit: I've tried your script and it gives me this error: PHP Code:
Quick Setup Your current site " site of the forum instead of executing the script. Somehow the query does not work. --------------- Added [DATE]1400020894[/DATE] at [TIME]1400020894[/TIME] --------------- Okay got it. The problem was that the command "ALTER TABLE" is wrong. |
Whoops! UPDATE for updating the table. ALTER for changing the table itself.
|
All times are GMT. The time now is 05:29 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:
|