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

Override XenForo_ViewPublic_Helper_Message

vbgamer45

Active member
#1
Trying to make an addon that overrides XenForo_ViewPublic_Helper_Message but can't seem to get it to pickup. Not sure if I am using the right event_id or if I can even override that function.

Have this in the addon xml file
Code:
  <code_event_listeners>
    <listener event_id="load_class_view" execute_order="10" callback_class="registeredlinks_Listener_LoadClassView" callback_method="loadClassListener" active="1" description="Listens for XenForo_ViewPublic_Helper_Message class"/>
 </code_event_listeners>
Then have this in the Listener
Code:
class registeredlinks_Listener_LoadClassView
{
        public static function loadClassListener($class, &$extend)
        {

            if ($class == 'XenForo_ViewPublic_Helper_Message')
            {
              $extend[] = 'registeredlinks_ViewPublic_registeredlinks';
            }

        }

}
Directory structure is library\registeredlinks\ViewPublic\registeredlinks.php
 

vbgamer45

Active member
#3
No other way to override it? Otherwise I would have to hook into bbcode but really only wanted it to affect messages only and not all bbcode parsing areas.
 

Shadab

Well-known member
#4
Unfortunately no. And since the methods contained in these helpers are used statically, it would've been hard to override them effectively anyway. Btw, this particular helper is used in the following view classes:
  • ViewPublic/Conversation/View.php
  • ViewPublic/Conversation/ViewNewMessages.php
  • ViewPublic/Thread/View.php
  • ViewPublic/Thread/ViewNewPosts.php
  • ViewPublic/Thread/ViewPosts.php
...so you can try extending these classes individually to achieve the same thing.
Not ideal. But it would work.