Fixed HtmlPublic view renderer notices bug

Robbo

Well-known member
Check at the comment "// handle style overrides".
$params is never defined. I assume it is meant to be $template->getParam() used instead.

PHP:
    protected function _getNoticesContainerParams(XenForo_Template_Abstract $template, array $containerData)
    {
        $notices = array();

        foreach ($this->_dependencies->notices AS $param => $noticeKey)
        {
            if ($template->getParam($param))
            {
                $notices[$noticeKey] = array(
                    'title' => new XenForo_Phrase($noticeKey),
                    'message' => $template->create($noticeKey, $template->getParams()),
                    'wrap' => true,
                    'dismissible' => false
                );
            }
        }

        if (XenForo_Application::get('options')->enableNotices)
        {
            if (XenForo_Application::isRegistered('notices'))
            {
                $user = XenForo_Visitor::getInstance()->toArray();

                if (XenForo_Application::isRegistered('session'))
                {
                    $dismissedNotices = XenForo_Application::getSession()->get('dismissedNotices');
                }

                if (!is_array($dismissedNotices))
                {
                    $dismissedNotices = array();
                }

                // handle style overrides
                if (!empty($params['visitorStyle']))
                {
                    $user['style_id'] = $params['visitorStyle']['style_id'];
                }

                foreach (XenForo_Application::get('notices') AS $noticeId => $notice)
                {
                    if (!in_array($noticeId, $dismissedNotices)
                        && XenForo_Helper_Criteria::userMatchesCriteria($notice['user_criteria'], true, $user)
                        && XenForo_Helper_Criteria::pageMatchesCriteria($notice['page_criteria'], true, $template->getParams(), $containerData))
                    {
                        $notices[$noticeId] = array(
                            'title' => $notice['title'],
                            'message' => $notice['message'],
                            'wrap' => $notice['wrap'],
                            'dismissible' => ($notice['dismissible'] && XenForo_Visitor::getUserId())
                        );
                    }
                }
            }
        }

        return $notices;
    }
 
Top Bottom