我为管理员安装了一个主题。刷新缓存,看起来很棒。我注销并重新登录并收到以下错误:
Fatal error: Call to a member function getId() on a non-object in app/code/core/Mage/Adminhtml/Block/Page/Menu.php on line 80
第65-89行:
public function getCacheLifetime()
{
return 86400;
}
/**
* Get Key pieces for caching block content
*
* @return array
*/
public function getCacheKeyInfo()
{
$cacheKeyInfo = array(
'admin_top_nav',
$this->getActive(),
Mage::getSingleton('admin/session')->getUser()->getId(),
Mage::app()->getLocale()->getLocaleCode()
);
// Add additional key parameters if needed /
$additionalCacheKeyInfo = $this->getAdditionalCacheKeyInfo();
if (is_array($additionalCacheKeyInfo) && !empty($additionalCacheKeyInfo)) {
$cacheKeyInfo = array_merge($cacheKeyInfo, $additionalCacheKeyInfo);
}
return $cacheKeyInfo;
}
如何解决此问题?
答案 0 :(得分:1)
请尝试Mage::getSingleton('admin/session')->getUser()->getUserId()
。