XF 2.0 Error explanation? Accessed unknown getter 'Thread' on XF:Trophy[4]

aana

Active member
Hello,
can someone tell me where this mistake came from?

The error message :
Code:
#0 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('Thread')
#1 internal_data/code_cache/templates/l2/s16/public/account_alerts.php(30): XF\Mvc\Entity\Entity->__get('Thread')
#2 src/XF/Template/Templater.php(1250): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#3 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('account_alerts', Array)
#4 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#5 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('XF:Account\\Aler...', 'public:account_...', Array)
#6 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#8 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#9 src/XF.php(329): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}
array(4) {
  ["url"] => string(15) "/account/alerts"
  ["referrer"] => string(95) "https://www.site.com/threads/threadname.117950/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

My code may generate this error ?

HTML:
<xf:if is="$alert->getContent()->Thread->node_id == 76 AND (!$xf.visitor.is_admin OR !$xf.visitor.is_moderator)">
    <xf:macro template="alert_macros" name="row" arg-alert="{$alert}" />
<xf:else />
...
 
Last edited:
You'll have to edit alert_post_ templates and set the user there. So to replace the user in template alert_post_insert, something like this can be done:

Add first:
PHP:
<xf:set var="$userForAlert" value="{{ $user }}" />

<xf:if is="$content.Thread.node_id == 76 AND (!$xf.visitor.is_admin OR !$xf.visitor.is_moderator)">
    <xf:set var="$userForAlert" value="{{ {'username': 'Trihard', 'user_id': 7} }}" />
</xf:if>

Find:
HTML:
'name': username_link($user, false, {'defaultname': $alert.username}),
Replace with:
HTML:
'name': username_link($userForAlert, false, {'defaultname': $userForAlert.username}),
 
Back
Top Bottom