The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Hack to Plugin
<font color="darkgreen">I am almost finished with what is turning out to be a huge hack so I figure it would be great as a plugin. Problem: Since most of the code and db mods are already in place, how would I go about changing it to be a plugin? How are plugins usually created? After the mod is installed or add/modify the plugin as you develop it?
Thanks</font> |
#2
|
||||
|
||||
Move all your physical code to plugins using hook locations at or near where you need the code executed. Add any database changes you've made to the Product XML's Install Code through the Product Manager.
I used to hack the physical files and then transfer to plugins - but after a while you remember what hooks are called where, or you can simply search in the files to see where each hook is eval'd -- and simply code solely through the plugin system. |
#3
|
||||
|
||||
<font color="darkgreen">Thanks but if I create a new product plugin and activate it, wont it execute any sql CREATE or ALTER TABLE queries?
I am not using any hooks so far as its all in new pages and templates with the exception of one modification to one standard template. But while I develop my product I should be doing so via the xml plugin or ? What do you do for inbetween phases of developing the eventual plugin? I asked earlier in another thread but never really got a detailed answer on hook usage. Could you point me to something other then a sentence or two in the vB docs? Thanks </font> |
#4
|
||||
|
||||
You should be developing all the code via the product system. Any SQL queries you need run should be placed into the install code.
|
#5
|
||||
|
||||
<font color="darkgreen">Ok, will create the product now. By checking out the other products I see they all contain one or more Plugins. I can create those too but for a template edit how do I incorporate that into a plugin or the product?</font>
|
#7
|
||||
|
||||
<font color="darkgreen">So far I have a couple of new templates and one minor template edit. I think if it grows with more template edits then I will use TMS.
Thanks though as I think it will prove valuable :thumb: So for a plugin, its mostly for injecting your code into the php file that you have edited and the product is just for the mysql code etc? Oh and where would I place a new php file? Edit: How do you get the plugin to create phrases and phrase groups?</font> |
#8
|
||||
|
||||
Think of the product as the house that contains all the plugins, phrases, templates, etc. When you add your Install/Uninstall code to the Product, it doesn't get executed - it's only run at Installation/Uninstallation.
You can place your new PHP file wherever - depending on what its purpose is; if it's to be accessed by users, then it should probably be right below your forum directory. Make sure your testboard is in debug mode, so you can access the developer options when creating new phrases and templates. You'll see a dropdown box below the Phrase/Template title where you can select a Product that it will go along with. |
#9
|
||||
|
||||
<font color="darkgreen">Ok, will do. As for the php file its already in place and working fine, just looking for placement in the plugin or product for installation of the php file?</font>
|
#10
|
||||
|
||||
Not sure what you mean in regard to installing the PHP file. If it just needs to be uploaded, simply tell the user as much - there's nothing additional you need to do in the Product.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|