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

Not a bug xen:hook not passing $contents by ref


Well-known member
When using a simple template hook I noticed that $contents wasn't available.

template member_view
<xen:hook name="member_view_sidebar_middle1" params="{xen:array 'user={$user}'}" />

and when I try to hook into it with
public static function xenMoods_TemplateHook($hookName, &$contents, array $params, XenForo_Template_Abstract $template)
        switch ($hookName)
            case "member_view_sidebar_middle1" :
                //do some stuff
                $contents =  $contents . $somestuff;
Looking at the debugger, the value of $contents was empty.


XenForo developer
Staff member
$contents holds any contents within the hook tag or those added by other, umm, let's call them "users of hooks". I'm sure you can come up with an inappropriate name for them. :) In this case, there are no children to the hook.