XF 2.1 Template Error: method canViewMedia is not callable


In the last couple of days I am getting many server errors for images on one thread. This thread has a lot of photos (I limit photos to 15 per post) and they don’t all display. I will paste in the error message below.

My server is running PHP 7.4.6.

What can I do to solve this? I have not changed anything on the forum software in a couple of months.

  • ErrorException: Template error: Method canViewResources is not callable on the given object (XF\Entity\User)
  • src/XF/Template/Templater.php:994
  • Generated by: Pauline
  • Sep 27, 2020 at 10:49 PM

Stack trace​

#0 [internal function]: XF\Template\Templater->handleTemplateError()
#1 src/XF/Template/Templater.php(994): trigger_error()
#2 internal_data/code_cache/navigation_cache.php(525): XF\Template\Templater->method()
#3 src/XF/Template/Templater.php(6660): XF\Pub\App->{closure}()
#4 src/XF/Pub/App.php(560): XF\Template\Templater->renderNavigationClosure()
#5 src/XF/Pub/App.php(513): XF\Pub\App->getNavigation()
#6 src/XF/App.php(2001): XF\Pub\App->renderPageHtml()
#7 src/XF/Mvc/Dispatcher.php(402): XF\App->renderPage()
#8 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render()
#9 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#10 src/XF.php(391): XF\App->run()
#11 index.php(20): XF::runApp()
#12 {main}

Request state​

array(4) {
["url"] => string(38) "/community/media/leh-palace.11370/full"
["referrer"] => string(80) "https://www.sloweurope.com/community/threads/ladakh-takes-your-breath-away.5476/"
["_GET"] => array(0) {
["_POST"] => array(0) {


I also see messages about max user connections.
  • User slow2_16 already has more than 'max_user_connections' active connections
  • src/XF/Db/Mysqli/Adapter.php:165
This is happening in one thread with a lot of photos.

Some of these posts have more than 15 photos uploaded, but I set a limit of 15.
Maximum attachments per message is 15.
The first error is strange and really only makes sense if add-ons are in a strange state. It should normally be consistent, but it might actually be connected to the max_user_connections error, perhaps actually masking that, so I'd troubleshoot that one first.

For the max_user_connections, unfortunately that's a server limitation that your host may have to increase (though they may not be willing to). It's probably being triggered by the attachments/media gallery loads, as that uses PHP and MySQL to get the necessary data, check permissions and serve the image.
Thanks, I will talk to them about this. The user is inserting images from the media gallery by copying the BB code, so IMG tag is used. When I change the images to insert using that camera icon above the input window, using the GALLERY tag, all images display.
Top Bottom