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

Filtering content in template

#1
Hi everyone,

I’ve developed an Add-On using the template_hook code event listener.
My purpose is to filter the content of some templates in certain parts of the website. I did it almost everywhere I need, except for two places “Recent Activity” and “Postings” on the Member profile page.
To access the text inside the template I’m using the following syntax :


PHP:
public static function template_hook ($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
 
  {
 
if($hookName == “my_template”) $contents = filter($contents)
 
}

The problem in these cases(“Recent Activity” and “Postings”) is that changing the $content variable the templates don’t change so I don’t know how to change the relative content

Can anyone help?

Thanks in advance
 
#3
Thanks Jake,

The post you suggested is very useful specially after spending most of my time finding the right hook :) but my current problem is to find the container variable not the hook.
I've tried to filter everywhere regardless the hook and it works fine except for the locations I told you on my post : “Recent Activity” and “Postings” on the Member profile page so I guess I’m using the wrong one for that particular template .
When I do the following

PHP:
public static function template_hook ($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
$contents = filter($contents) // it filter everywhere
}
My content is filtered in every place but the tabs in object. My question is :
Is $content the right variable to filter?
Is there any other variable which contains the data?
I attach a couple of screenshots to explain you clearly.
The first one is an example if filtered content while the others are not filtered
 

Attachments