old templatehook code to update

Kintaro

Well-known member
Xentrader is unsupporter right now.

Actually with a fix can work with php >5.4 but it lacks a thing... feedbacks stats in the messageuserinfo

searching in the code of it I found this code in the TemplateHook.php file:

Code:
    protected function _messageUserInfoText(&$contents)
    {
        $forum = $this->_template->getParam('forum');

        if (in_array($forum['node_id'], XenForo_Application::get('options')->xentraderForums))
        {
            $dom = new Zend_Dom_Query($contents);

            $username = $dom->query('.username');

            $user = $this->_getXfUserModel()->getUserByname($username->current()->nodeValue);
            if ($user = $this->_getUserModel()->getUserById($user['user_id'], array('join' => XenTrader_Model_User::FETCH_XF_USER)))
            {
                $username->current()->setAttribute('style', 'display: inline;');

                $newNode = $username->getDocument()->createElement('span');
                $newNode->nodeValue = ')';
                $username->current()->parentNode->insertBefore($newNode, $username->current()->nextSibling);

                $newNode = $username->getDocument()->createElement('a');
                $newNode->setAttribute('href', XenForo_Link::buildPublicLink('xentrader', $user));
                $newNode->nodeValue = $user['total'];
                $username->current()->parentNode->insertBefore($newNode, $username->current()->nextSibling);

                $newNode = $username->getDocument()->createElement('span');
                $newNode->nodeValue = ' (';
                $username->current()->parentNode->insertBefore($newNode, $username->current()->nextSibling);

                $newNode = $username->getDocument()->createElement('em');
                $newNode->setAttribute('class', 'userTitle');
                switch ($this->_getUserModel()->getUserType($user))
                {
                    case XenTrader_Model_User::TRADER_TYPE_NEW: $newNode->nodeValue = new XenForo_Phrase('xentrader_new_trader'); break;
                    case XenTrader_Model_User::TRADER_TYPE_TRUSTED: $newNode->nodeValue = new XenForo_Phrase('xentrader_trusted_trader'); break;
                    case XenTrader_Model_User::TRADER_TYPE_KNOWN: $newNode->nodeValue = new XenForo_Phrase('xentrader_known_trader'); break;
                }
                $username->current()->parentNode->appendChild($newNode);

                $contents = $username->getDocument()->saveHTML();
            }
        }

    }

can someone help me to update this to make the feedback stats appear again?
can you give me some hints on where watch to study a solution on my own?
 
Back
Top Bottom