XF 1.2 Hook parameters are not updating

I'll be honest, maybe this is Widget Framework question? Sorry if its...

I created a hook in the message template under the signature div like so:
Code:
        <xen:hook name="message_below_signature" params="{xen:array 'message_user_id={$message.user_id}','message_id={$messageId}'}"/>

I then created a new template called "custom_signature_template"
Code:
message_user_id: {$message_user_id}<br/>
message_id: {$message_id}

I then created an "[Advanced] Template (without wrapper)" widget.
Set the template to "custom_signature_template" and the position to "hook:message_below_signature"

Every single message has the message_user_id & message_id of the first message in the thread.
I was expecting that each message would receive the parameter values for that specific message.

Looks like it's almost loading the hook template contents once and feeding it to every hook event?
Dunno :(

TY!
 
Please direct your questions to the widget framework.

Thanks, I apologize...Since it had to do with hooks I wasn't sure, seems obvious now.

After working on it for couple hours, I ended up getting rid of the widget anyway and adding the following hook listener:

PHP:
<?php



class BoG_HookListener

{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch($hookName){
            case 'message_below_signature':{
                foreach($hookParams as $key => $item)
                    if ($key == 'message_user_id') $uid = $item;

                if (!is_null($uid)){
                    $userModel = XenForo_Model::create('XenForo_Model_User');
                    $user = $userModel->getUserById($uid);
                }

                $contents .= $template->create('custom_signature_template', array_merge($template->getParams(), $hookParams, array(user=>$user)));
                break;
            }
        }
    }
}
 
Top Bottom