The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP / Vbulletin Interaction
Hi,
What are the variables for userid, etc for PHP? How would I write a PHP script that is as follows if user is a member of usergroup 1: do this else: do this ? How do I get PHP to pull user data, and interact? Thanks |
#2
|
|||
|
|||
do you want php to pull data from the database or a session?
If its from a session use the $vbulletin->userinfo $vbulletin->userinfo['username'] will give you the username i havent had to do anything with usergroups but should be pretty easy to work out if its from the database should be pretty easy |
#3
|
|||
|
|||
hi, thanks for the reply,
so any idea on how I could get a script to change the logged in user's USERGROUP to a number when it is run? |
#4
|
|||
|
|||
Quote:
<vb:if condition="is_member_of($bbuserinfo, 1)">Do this<vb:else />Or else this</vb:if> |
#5
|
|||
|
|||
can I put that directly in a .php file and it will still execute?
|
#6
|
|||
|
|||
No. I don't think anyone understands what you were asking lol. That last bit of code is for the templates within vB and that other bit of code would only work if the userinfo array has been populated.
There will be a lot of threads on this but the usual way to integrate is to include vb's global.php file (like I said there will be a lot of threads about this so do a search - "external php vbulletin" or something in google). This will populate the variables you need and then you can start using the userinfo array. And that array will contain the usergroupid's for that user. But a user can be in several usergroups so you'll need to explode (explode function) the field using commas as your separator. And then check if the usergroup you are looking for is in that array (in_array function). I myself handle it all manually. i.e. I check whether the user is logged in or not, if so then I do a mysql query on the user table to pull back the user's information and load that into an array of my own. |
#7
|
|||
|
|||
thanks a ton!!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|