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

Looking for the user ID for custom template.

Discussion in 'XenForo Development Discussions' started by Floris, Sep 16, 2011.

  1. Floris

    Floris Guest

    To show an icon next to the name in a post, linking directly to the profile.
    I made a Listener.php that injects my own template in the hook at message_user_info_text
    I use .css to mark it up.

    It's very basic, but a crucial element the user id isn't available or I simply don't know which to use.

    Attached is the 100b1 I have so far, consider it alpha. Looking forward for the 'doh' moment. Because I know it's something very simple.

    I've tried {$user.user_id} , {$message.username} , {$xen:help user_id, $user} and a few other things I don't remember atm.

    Reference: related to this thread. http://xenforo.com/community/thread...ink-to-users-profile-page-from-postbit.19954/

    Attached Files:

  2. ragtek

    ragtek Guest

    You need to user_id which is sent to the template hook event listener via

    params="{xen:array 'user={$user}'

    so inside your template hook you need to add this to the viewparam array

        public static function templateHook($name, &$contents, array $paramsXenForo_Template_Abstract $template)
    // $options = XenForo_Application::get('options'); // lets get those options
            // $options->xenfans_profilethingy_whateveroption == 1
    switch ($name)
    $viewParams array_merge($template->getParams(), $params); // then you have access
    $temp_contents $template->create('xenfans_profilethingy'$viewParams);
    // swtich
    $contents $temp_contents $contents;

    // end public
     // end class
    # EOF
  3. Floris

    Floris Guest

Share This Page