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

Not a bug Hooks in node_forum_level_2 vs node_category_level_2

#1
It seems the node_forum_level_2_before_lastpost hook is only active in the forum template, although the category template is similarly set up to show the last post.

Needed this location for a plugin and essentially found myself doing a quick and dirty fix in the meantime - thought i'd mention it here.
 

Chris D

XenForo developer
Staff member
#2
Template hooks are deprecated so I don't think we'll be looking to make any changes here, even for consistency.

Template modifications should be used instead. Template hooks have been removed from XF2.
 
#3
Gotcha!

I wonder how modifications vs hooks will play with multiple AddOns running where 1 has an inconsistency or is made for an earlier version, etc.

Seems like it can cause more compatibility issues, no? Just thinking aloud here, I'm sure you guys have thought of this.
 

Chris D

XenForo developer
Staff member
#4
Some hooks, such as this one, are in self closing tags and therefore you're just injecting additional code directly into that location, though a lot of hooks contain code themselves, and the scope for conflicts in these is about the same as template modifications because it's still essentially a find and replace. But TMs can be applied anywhere and they modify the template before compilation and those changes are then compiled into the final template.

Ultimately, it is much more flexible, but, yes, conflicts can happen, but thankfully they are somewhat rare and simple to resolve.
 
#5
Yea, I hear ya.

Definitely enjoy the flexibility of TM's vs hooks. I use hooks sometimes on heavily modded forums only because I dread having to rely on the previous coders having delivered the content back properly hah but you're right, TM's are the way to go!

Best of luck with Xen2 by the way, excited for the release!