lucien_lies
Active member
I am trying to insert user banners in their posts, and it works correctly, but when a guest comments this error is displayed in the console:
my code:
Code:
ErrorException: Template error: [E_USER_WARNING] Cannot call method getBannerUrl on a non-object (NULL) src/XF/Template/Templater.php:1176
Generated by: 5 Minutos Nov 14, 2022 at 6:03 PM
Stack trace
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/www/wwwroot/fo...', 1176, Array)
#1 src/XF/Template/Templater.php(1176): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l2/s4/public/5minutos_message_banners.php(7): XF\Template\Templater->method(NULL, 'getBannerUrl', Array)
#3 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#4 src/XF/Template/Templater.php(1680): XF\Template\Templater->renderTemplate('5minutos_messag...', Array)
#5 internal_data/code_cache/templates/l2/s4/public/message_macros.php(13): XF\Template\Templater->includeTemplate('public:5minutos...', Array)
#6 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#7 internal_data/code_cache/templates/l2/s4/public/post_macros.php(25): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
#8 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('user_cell', Array, Array, Object(XF\Template\ExtensionSet))
#10 internal_data/code_cache/templates/l2/s4/public/post_macros.php(146): XF\Template\Templater->renderExtension('user_cell', Array, Object(XF\Template\ExtensionSet))
#11 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#12 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
#13 internal_data/code_cache/templates/l2/s4/public/post_macros.php(178): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
#14 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#15 internal_data/code_cache/templates/l2/s4/public/thread_view.php(842): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
#16 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#17 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
#18 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#19 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#20 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#21 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#22 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#23 src/XF/App.php(2353): XF\Mvc\Dispatcher->run()
#24 src/XF.php(524): XF\App->run()
#25 index.php(20): XF::runApp('XF\\Pub\\App')
#26 {main}
my code:
Code:
<div class="postbit_background" style="background-image: url({$user.Profile.getBannerUrl($size)});"></div>