Support Forum
From time to time, I may need to modify certain functions in SP, or more likely, one of its plugins.
I would like to be able to do so in such a way that updates to SP or one of its plugins does not overwrite my customization. In this way, I can evaluate the changes in the new version and decide in an organized fashion whether I can safely remove my customization (obviously, this would be preferred), or if I need to leave it in place or even modify it further.
Apart from filters and action hooks, what is the best practice way to do this in PHP/WordPress/SP?
For example, the file sp-email-post-imap.php contains a function sp_process_inbox_imap(). Let's assume for discussion that this function is not called as part of a filter or hook chain.
If I wanted to modify sp_process_inbox_imap(), is there a way to do it so that my mods won't be overridden by future updates to sp-email-post-imap.php?
I am new to PHP & WordPress, so forgive me if this is either a FAQ or an impossibility, but I was thinking along these lines.
Define my own plugin: call it MySPCustomizations and in that plugin redefine the sp_process_inbox_imap() function. If my function is defined after SP's function, will mine always be called?
Or is there a better way? Appreciate any guidance here!
Thanks!
The bottom line and simple truth is that of you change code in any plugin or core then it will get lost on subsequent updates. It is possible to create alternative functions that already exist in the WP or SP core (look at the 'pluggable.php' file in the WordPress code for examples of how to do this) but this needs the original core code to be created specifically for that purpose.
We have tried to use filter and action hooks as extensively as possible to enable custom coding to be achieved without disturbing supplied code but that will always have certain limitations. I would suggest that if you decide you need to make changes and when you work out what they are, see if they could be achieved with the addition of a new filter/action as we will always be willing to add new ones into core. if not come and talk it over with us and we can see if we can come up with a model that would allow you not to lose your custom code.
YELLOW
SWORDFISH
|
but you could change the name/version and make it your own plugin... then it wont get over written... but of course, you wont get any updates either...
Visit Cruise Talk Central and Mr Papa's World
let us know how you make out with it... we can offer guidance if needed or perhaps more hooks...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)