XF 2.2 ErrorException: Template error: [E_USER_WARNING] Cannot call method getConsentedGroups on a non-object (NULL)

tymillzz

Member
Hello, i have this error code, have any idea ?
Thanks for all
Code:
    ErrorException: Template error: [E_USER_WARNING] Cannot call method getConsentedGroups on a non-object (NULL) src/XF/Template/Templater.php:1176

    Généré par: Compte inconnu 22/2/24, à 12:03

Trace de la pile

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/home/.', 1176, Array)
#1 src/XF/Template/Templater.php(1176): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l6/s24/public/helper_js_global.php(166): XF\Template\Templater->method(NULL, 'getConsentedGro...', Array)
#3 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#4 internal_data/code_cache/templates/l6/s24/public/PAGE_CONTAINER.php(3762): XF\Template\Templater->callMacro('helper_js_globa...', 'body', Array, Array)
#5 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#6 src/XF/Pub/App.php(564): XF\Template\Templater->renderTemplate('PAGE_CONTAINER', Array)
#7 src/XF/App.php(2150): XF\Pub\App->renderPageHtml('
    
    




    <div ...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#8 src/XF/Mvc/Dispatcher.php(404): XF\App->renderPage('
    
    




    <div ...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#9 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(2352): XF\Mvc\Dispatcher->run()
#11 src/XF.php(524): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}

État de la demande

array(4) {
  ["url"] => string(24) "/whats-new/posts/798818/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
If nit, it's an issue with the ThemeHouse style

I'm not sure what gives you that idea, our themes don't do anything different with this line than the default theme.

From helper_js_global

Default theme:

Code:
consented: {{ $xf.cookieConsent.getConsentedGroups()|json|raw }}

Our themes:

Code:
consented: {{ $xf.cookieConsent.getConsentedGroups()|json|raw }}

This is exactly the same.

The value that is null here is $xf.cookieConsent which is from core XenForo. From the looks of it, you're running an older version of XenForo which doesn't have this feature yet, it must be <= 2.2.11 as XenForo added this feature to 2.2.12, but you're using the latest version of one of our themes. If you're on an older version of XenForo, you'll need to use an older version of the theme that is compatible with that version.

The reason you don't have the issue on the default theme is because it will have the correct version of the template for your XenForo version which doesn't contain this code. As you're using a newer version of the theme, the template does have this code, but cookieConsent isn't defined in core XF so it errors. It's not a bug with the theme if you're using a version that is for a newer version of XenForo than you are running.
 
Back
Top Bottom