Released 2x Template error: [E_WARNING] Attempt to read property "group_id" on null

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

Hi, i've installed this Add-on https://enxf.net/resources/xtr-reputation-system.1265/ but i have an error and i need help fixing this, i have xenforo version 2.2.8 path 1. i uploaded the addon through ftp cuz it was not be installed via acp due to error of "file does not appear to be a valid add-on archive as expected"


Code:
Stack trace
#0 src/addons/XENTR/ReputationSystem/MacroRender.php(9): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Att...', '/home/u35726842...', 9)
#1 src/XF/Extension.php(52): XENTR\ReputationSystem\MacroRender::preRender(Object(XF\Template\Templater), 'admin', 'option_macros', 'option_form_blo...', Array, Array)
#2 src/XF/App.php(2853): XF\Extension->fire('templater_macro...', Array, 'admin:option_ma...')
#3 src/XF/Template/Templater.php(761): XF\App->fire('templater_macro...', Array, 'admin:option_ma...')
#4 internal_data/code_cache/templates/l1/s0/admin/trophy_list.php(64): XF\Template\Templater->callMacro('option_macros', 'option_form_blo...', Array, Array)
#5 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#6 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('trophy_list', Array)
#7 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#8 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Trophy\\Listi...', 'admin:trophy_li...', Array)
#9 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#10 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#12 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#13 src/XF.php(517): XF\App->run()
#14 admin.php(13): XF::runApp('XF\\Admin\\App')
#15 {main}

Code:
Request state
array(4) {
  ["url"] => string(20) "/admin.php?trophies/"
  ["referrer"] => string(66) "https://undead-project.xyz/admin.php?options/groups/XTRReputation/"
  ["_GET"] => array(1) {
    ["trophies/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

The code of Macrorender.php addon:
Code:
<?php

namespace XENTR\ReputationSystem;

class MacroRender
{
    public static function preRender(\XF\Template\Templater $templater, &$type, &$template, &$name, array &$arguments, array &$globalVars)
    {
        if ($arguments['group']->group_id == 'XTRReputation')
        {
            $template = 'Reputation_macros';
        }
    }
}
 
Last edited:

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
368
Points
103

Reputation:

You have missed mentioning an important part of error message, you just pasted the stack trace, the main error message is missing
 

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

You have missed mentioning an important part of error message, you just pasted the stack trace, the main error message is missing
Soft4WinWhere i can find the main error message then?
 
View previous replies…

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

Its on the same page, its written above the stack error part.
Soft4WinI've uninstalled the Add-on due that error, but i think this is the error, someone of the two this messages:

This is the request state:
Code:
array(4) {
  ["url"] => string(20) "/admin.php?trophies/"
  ["referrer"] => string(66) "https://undead-project.xyz/admin.php?options/groups/XTRReputation/"
  ["_GET"] => array(1) {
    ["trophies/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

I go to to the file(Macrorender.php) location which has mentioned by the error log:

Code:
<?php

namespace XENTR\ReputationSystem;

class MacroRender
{
    public static function preRender(\XF\Template\Templater $templater, &$type, &$template, &$name, array &$arguments, array &$globalVars)
    {
        if ($arguments['group']->group_id == 'XTRReputation')
        {
            $template = 'Reputation_macros';
        }
    }
}

I'm using PHP version 8.0,
 

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
368
Points
103

Reputation:

I've uninstalled the Add-on due that error, but i think this is the error, someone of the two this messages:

This is the request state:
Code:
array(4) {
  ["url"] => string(20) "/admin.php?trophies/"
  ["referrer"] => string(66) "https://undead-project.xyz/admin.php?options/groups/XTRReputation/"
  ["_GET"] => array(1) {
    ["trophies/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

I go to to the file(Macrorender.php) location which has mentioned by the error log:

Code:
<?php

namespace XENTR\ReputationSystem;

class MacroRender
{
    public static function preRender(\XF\Template\Templater $templater, &$type, &$template, &$name, array &$arguments, array &$globalVars)
    {
        if ($arguments['group']->group_id == 'XTRReputation')
        {
            $template = 'Reputation_macros';
        }
    }
}

I'm using PHP version 8.0,
AlmightyOh i see, i Missed reading the title lol, my bad, the title of the thread specifies the error :

Template error: [E_WARNING] Attempt to read property "group_id" on null​


So the thing is this error is kind of strange, and i have been seeing this error alot from alot of addons, since upgrading to 2.2.8 Patch 1, so maybe something has changed in that release. Will look more into it and see if i can find something and update here
 

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

Oh i see, i Missed reading the title lol, my bad, the title of the thread specifies the error :

Template error: [E_WARNING] Attempt to read property "group_id" on null​


So the thing is this error is kind of strange, and i have been seeing this error alot from alot of addons, since upgrading to 2.2.8 Patch 1, so maybe something has changed in that release. Will look more into it and see if i can find something and update here
Soft4WinIt's okay, i'll be patiently wait for your help!
 

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

Oh i see, i Missed reading the title lol, my bad, the title of the thread specifies the error :

Template error: [E_WARNING] Attempt to read property "group_id" on null​


So the thing is this error is kind of strange, and i have been seeing this error alot from alot of addons, since upgrading to 2.2.8 Patch 1, so maybe something has changed in that release. Will look more into it and see if i can find something and update here
Soft4Win:)
 

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
368
Points
103

Reputation:

It's okay, i'll be patiently wait for your help!
AlmightySo here is the fix, the thing is this error occurs when visiting advertising section of XenForo, so a slight change in some addons is required to prevent that error.

Fix in case of this addon is as follows:
Preferred Option: Update the addon, if the fix has been implemented in that.

Otherwise
Edit the following file : /src/addons/XENTR/ReputationSystem/MacroRender.php

Replace:
PHP:
if ($arguments['group']->group_id == 'XTRReputation')

with:
PHP:
if ($arguments['group'] && $arguments['group']->group_id == 'XTRReputation')
 

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

So here is the fix, the thing is this error occurs when visiting advertising section of XenForo, so a slight change in some addons is required to prevent that error.

Fix in case of this addon is as follows:
Preferred Option: Update the addon, if the fix has been implemented in that.

Otherwise
Edit the following file : /src/addons/XENTR/ReputationSystem/MacroRender.php

Replace:
PHP:
if ($arguments['group']->group_id == 'XTRReputation')

with:
PHP:
if ($arguments['group'] && $arguments['group']->group_id == 'XTRReputation')
Soft4WinI already did that and It's not showing the reputation system bar and text in the profile:
Screenshot_1.png


When i was clicked in "install" in Add-ons this message has appear:
errortemp1.png
 

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
368
Points
103

Reputation:

Almighty

Well-known member
Registered
Joined
Feb 5, 2020
Messages
60
Points
18

Reputation:

Make sure permissions are set to view the reputation.
Soft4WinOk now i have an question, why don't i see the reputation text? I've activate the "animation bar rank"to test if something aren't working well, and appearly that's not working.

Images:
Screenshot_1.png


Screenshot_2.png
 
Top