- b2evolution CMS Support Forums
- b2evolution Support
- General Support
- [2.x] Using plugin 'hooks' for 'hacks'
1 blogmeister Jan 11, 2009 01:35
My b2evolution Version: 2.x
ref: http://forums.b2evolution.net/viewtopic.php?t=17573&start=15
Hello.
I'm completely new at using plugins for hacks so this is my next major goal at trying to use them and use them effectively. I'm hoping others will chime in to show me how to use it as it was intended.
Until then, here's what I've done so far (starting yesterday) to try to reduce the amount of file hacking:
I created a class that extends the 'Plugin' class. I added routines (methods) in that new class and used them like other distro objects.
The reason being for doing it this way other than lack of knowledge about its proper use is that if other plugin developers begin using the distro's '_plugin.class.php' to add more methods to, I don't want to constantly keep adding my functions to their revised version for each new plugin/widget I add. Hopefully, others will just add a new class file for their application that extends the distro's 'Plugin' class so after each new plugin install, the developer's revisions from the previous developer's version of hacks to '_plugin.class.php' don't have to be added too. If they create their own extended plugin class, we would just have to upload the new file.
Having said that, now I have to formally ask, HOW TO USE THE PLUGIN SYSTEM SO I CAN STOP HACKING SO MANY FILES? :?:
My v.2.4.5 is hacked to the hilt and I'm not finished either. When the time comes to upgrade to v.2.4.6, it would probably be way in the future for me due to the time needed to convert all of the changes I've made.
Again, any suggestions are welcomed.
Thanks in advance.
inc/plugins/model/_plugins_admin.class.php ( approx 52 ) is your friend, it lists all ( most ) of teh currently available hooks for plugins
You should never hack the core plugin files, they're only ever meant to be extended ( take a look at /plugins/_test_plugin.php && _skeleton_plugin.php for examples )
¥