The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Creating a product - what variables are available?
I am trying to create a new product with its own plugins and templates. When I add a new plugin to my product, how do I know what objects are created and available, and what variables are set? The vBulletin manual states:
Quote:
|
#2
|
|||
|
|||
The product itself does nothing. It's just a container to your plugins. You have to look in each PHP file for the hook locations and then create a plugin which uses said hook. It will inject the code that you put into the plugin where you see ($hook= etc, etc)
|
#3
|
|||
|
|||
Thank you. Yes, I understand that the plugin will "replace" the corresponding hook in the php file with my plugin code. But before vBulletin loads that said file it also loads a number of others, where objects and variables are initialised, creating a working environment for my plugin. I am trying not to reinvent the bicycle by querying the database for the data that has been pulled already and is just sitting somewhere in an object I don't know about. That's what I am trying to figure out - how do I know what variables and objects are created by the time my hook is pulled up. I hope vBulletin provides some documentation on this and not just "go through the code" advice, although either one is appreciated.
|
#4
|
|||
|
|||
You read the code. Honestly, that's what I've seen a lot of other people say to do. It's personally how I learned how to program for vBulletin. You need to see what's defined in the PHP file for whatever you're trying to do. For example, if you want to do something right before a post is accepted and parsed into the database, you look for the proper hook (They have pretty easy to understand names) and then put in your code in that hook. The proper classes and functions that you'll need will be there elsewhere in the file.
The API is handy because it tells you the arguments for the functions and such, but it's not going to tell you what's in each of the files. |
#5
|
||||
|
||||
vBulletin does not have some list somewhere that tells you exactly what has been defined already at every hook location. You need to look at the php page and see what has been defined already.
|
#6
|
|||
|
|||
Beat you to it
|
#7
|
||||
|
||||
So you did!
|
#8
|
|||
|
|||
At first when I saw people saying "just read the code", I thought it was some sort of condescending "ur a n00bz lol" thing, but then I realized that there's no way to really code anything without going through the PHP files.
|
#9
|
||||
|
||||
'Reading' the code also helps to tell you the name of the variable you want to use ($group or $discussion for example) and tells you if some fields other than the fields in the table have already been 'calculated' or evaled for you. It really does help to find your hook in the code and look at the stuff around it.
|
#10
|
|||
|
|||
Thank you very much guys!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|