Getting this error on 2 or 3 XF2 forums:
Why is this happening and how do I fix it?
Code:
Drumsmoking error
ErrorException: Template error: [E_USER_WARNING] Method canViewMedia is not callable on the given object (XF\Entity\User) src/XF/Template/Templater.php:1186
Generated by: Unknown account May 18, 2022 at 6:18 AM
Stack trace
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '{path/to/forum/}', 1186)
#1 src/XF/Template/Templater.php(1186): trigger_error('Method canViewM...', 512)
#2 internal_data/code_cache/navigation_cache.php(273): XF\Template\Templater->method(Object(XF\Entity\User), 'canViewMedia', Array)
#3 src/XF/Template/Templater.php(7518): XF\Pub\App->{closure}(Object(XF\Template\Templater), 'members', Array)
#4 src/XF/Pub/App.php(577): XF\Template\Templater->renderNavigationClosure(Object(Closure), 'members', Array)
#5 src/XF/Pub/App.php(528): XF\Pub\App->getNavigation(Array, 'members')
#6 src/XF/App.php(2150): XF\Pub\App->renderPageHtml('
<div ...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#7 src/XF/Mvc/Dispatcher.php(404): XF\App->renderPage('
<div ...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#8 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(2352): XF\Mvc\Dispatcher->run()
#10 src/XF.php(524): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}
Request state
array(4) {
["url"] => string(19) "/members/10202.html"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
Why is this happening and how do I fix it?