AndyB
Well-known member
Hello,
I'm creating an add-on called Forum statistics and I would like to show the latest user in a widget.
My PHP code
My template code
The code I'm copying is from the widget_forum_statistics template:
How come my object called $userLatest is not working? I would assume because I'm creating the object using the finder it would have all the data required.
Thank you for your help.
I'm creating an add-on called Forum statistics and I would like to show the latest user in a widget.
My PHP code
PHP:
$finder = \XF::finder('XF:User');
$userLatest = $finder->order('register_date', 'DESC')->limit(1)->fetch();
My template code
Code:
<dl class="pairs pairs--justified">
<dt>{{ phrase('latest_member') }}</dt>
<dd><xf:username user="{$userLatest}" /></dd>
</dl>
The code I'm copying is from the widget_forum_statistics template:
Code:
<dl class="pairs pairs--justified">
<dt>{{ phrase('latest_member') }}</dt>
<dd><xf:username user="{$forumStatistics.latestUser}" /></dd>
</dl>
How come my object called $userLatest is not working? I would assume because I'm creating the object using the finder it would have all the data required.
Thank you for your help.
Last edited: