• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add-On Collisions

digitalpoint

Well-known member
#1
So I started digging around the event listener system for hooking into existing classes, and I really like it so far since it's pretty generic and allows you to hook into most anything.

But it got me thinking... what happens if a site has two different add-ons that are both extending the same method?
 

Shadab

Well-known member
#2
That depends upon whether the addons are calling the parent methods or not. If they are, both of the addons will work. Because of the way proxy classes are evaluated at runtime, parent:: for the second addon would be the overriding method of your first addon.

Sample Class Hierarchy...
Code:
XenForo_ControllerPublic_Index
            ↑
XFCP_Addon1_ControllerPublic_Index (Proxy Class)
            ↑
Addon1_ControllerPublic_Index
            ↑
XFCP_Addon2_ControllerPublic_Index (Proxy Class)
            ↑
Addon2_ControllerPublic_Index
 
R

ragtek

Guest
#3
I hadn't time to check how it's working exactly, but it's working.

I have 4 add-ons extending the _postSave method in the user datawriter, and all are working now ( i've forgotten to call the parent postSavein the past) nice. (that means, after a user registration, add-on 1 creates a welcome thread, add-on2 starts a conversation, add-on3 sends a mail to the admin, add-on4 is making some hidden stuff^^
 

Jeremy

Well-known member
#6
I'm bumping this because I had a quick question on something. The "Callback Execution Order," if I set that to something really, really, extremely high (say 100000), I can nearly ensure that when XF creates the proxy classes, my class will be defined last. Correct? Question being is I'm thinking about setting it up so that I can do so with BBCM to allow for more modifications to inject their own BBCodes and have mine inherit them. ;)