AdamCapriola
Member
I'm in the process of porting a vB add-on I created that does a simple search/replace on content within posts and conversations, excluding sigs and whatnot, just the messages themselves (I search for certain keywords to link them to reference pages). I've followed along with Kier's video, which helped explain a lot about the hooks, but I'm not sure if there is a way to further specify a hook, if I'm approaching this the wrong way, or if this is even possible.
Right now, I'm looking at the 'message_content' hook. This is what I've tried so far:
The Code Event Listener is 'template_hook'.
This does a marvelous job at adding 'This is a test."... but to practically every hook on the screen! It seems like a lot of templates use 'message_content', but I am trying to limit it to just posts and conversations.
The hook I used in vB was 'postbit_display_complete', if that helps at all. I tried to deconstruct this addon since it seems similar to what I'm trying to do, but I had trouble deciphering the code. I have a long list of search/replace pairs, and I'm just trying to do copy them over as simply as possible.
Thanks in advance for any help!
Right now, I'm looking at the 'message_content' hook. This is what I've tried so far:
PHP:
<?php
class Demo_Addon
{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if ($hookName = 'message_content')
{
$contents .= 'This is a test.';
}
}
}
The Code Event Listener is 'template_hook'.
This does a marvelous job at adding 'This is a test."... but to practically every hook on the screen! It seems like a lot of templates use 'message_content', but I am trying to limit it to just posts and conversations.
The hook I used in vB was 'postbit_display_complete', if that helps at all. I tried to deconstruct this addon since it seems similar to what I'm trying to do, but I had trouble deciphering the code. I have a long list of search/replace pairs, and I'm just trying to do copy them over as simply as possible.
Thanks in advance for any help!