User Activity by Xon

User Activity by Xon 2.13.2

No permission to download
Good morning, I also am experiencing some errors after the upgrade

  • ErrorException: [E_NOTICE] Undefined index: id
  • src/addons/SV/UserActivity/Repository/UserActivity.php:126

Stack trace
Code:
#0 src/addons/SV/UserActivity/Repository/UserActivity.php(126): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/var/www/vhosts...', 126, Array)
#1 src/addons/SV/UserActivity/UserActivityInjector.php(77): SV\UserActivity\Repository\UserActivity->insertUserActivityIntoViewResponse('XF\\Pub\\Controll...', Object(XF\Mvc\Reply\View))
#2 src/XF/Mvc/Dispatcher.php(383): SV\UserActivity\XF\Pub\Controller\Conversation->postDispatch('View', Object(XF\Mvc\ParameterBag), Object(XF\Mvc\Reply\View))
#3 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF\\Pub\\Controll...', 'View', Object(XF\Mvc\RouteMatch), Object(SV\UserActivity\XF\Pub\Controller\Conversation), Object(XF\Mvc\Reply\Reroute))
#4 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\UserActivity\XF\Pub\Controller\Conversation), Object(XF\Mvc\Reply\Reroute))
#5 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#7 src/XF.php(512): XF\App->run()
#8 index.php(20): XF::runApp('XF\\Pub\\App')
#9 {main}

Request state

Code:
array(4) {
  ["url"] => string(31) "/conversations/vin.77975/page-2"
  ["referrer"] => string(42) "https://redacted.com/conversations/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
@Xon hello,

i read all discussion, but didnt find my case.

after update i see tons of errors below with different urls (usually forum of forums and forum thread list pages),
but UserActivity shows normal, as i see. don't understand where the argument headerPhrase lost.

Xenforo ver: 2.2.6 Patch 1
php: 7.4.19

Code:
LogicException: Macro public:UA_ViewContainer_macros :: UserActivity() error: Macro argument headerPhrase is required and no value was provided src/XF/Template/Templater.php:896

Stack strace:
#0 src/XF/Template/MacroState.php(60): XF\Template\Templater->mergeMacroArguments(Array, Array, Array)
#1 src/XF/Template/Templater.php(789): XF\Template\MacroState->getAvailableVars(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#2 internal_data/code_cache/templates/l2/s3/public/forum_view.php(729): XF\Template\Templater->callMacro('UA_ViewContaine...', 'UserActivity', Array, Array)
#3 src/XF/Template/Templater.php(1644): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('forum_view', Array)
#5 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#6 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Forum\\View', 'public:forum_vi...', Array)
#7 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#11 src/XF.php(512): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
It looks like you have an out-of-date template
plugin template or XF?

UA_ViewContainer_macros template, was modified by me earlier
but after update i merge it, just a little style fix, no any unknown variable declarations here
Code:
<h3 class="block-minorHeader">{$headerPhrase}</h3>
                
to
                
<h3 class="block-minorHeader">
    <div class="rf_activity_header">
         {$headerPhrase}
    </div>
</h3>

maybe uninstall and reinstall the plugin? can these actions fix it?
 
Try rebuilding the add-on, the template modification which is injecting the template macro call doesn't appear to be working as expected.

It should adding something like this;
Code:
<xf:macro template="UA_ViewContainer_macros" 
          name="UserActivity" 
          arg-headerPhrase="{{ phrase('svUserActivity_users_who_are_viewing_this_forum') }}" 
          arg-records="{$UA_Records}"/>

Into the forum_view template. Use the View XX template modifications link on the template that my StandardLib add-on adds to confirm what the template ends up looking like.
 
@Xon thanks, figured it out.

the error was on my side, a couple of years ago I modified one of the templates, and inserted the macro template manually, in a specific place, and since inside it changed with the update and began to require the declaration of a argument headerPhrase, the thing started to fall into errors :)

Thanks for the help! you are awesome)
 
In SV\UserActivity\Repository\UserActivity::getUsersViewing()
PHP:
$rec = @\array_combine(self::CacheKeys, $data);
might generate a ValueError in PHP 8 if the amout of keys does not match.

Changing this to smth. like
PHP:
try
{
    $rec = @\array_combine(self::CacheKeys, $data);
}
catch (\ValueError $e)
{
}
seems to silence it for 7 and 8.
 
Last edited:
  • Like
Reactions: Xon
might generate an a ValueError in PHP 8 if the amout of keys does not match.
I've made that change. The data stored in redis hasn't had its schema chance since the XF1 version so rather a low priority and will go out in the next bugfix update at some stage.
 
Without using redis cache - should this version for XF2 perform as well as the XF1 version does (without any extra caching configuration)? We currently have no issues using the XF1 version on our XF1 boards.

Amazing plugin, by the way :) I don't know why this feature wasn't bilt into XF from the start like it was for VB.

Thanks
 
It should work OK, the add-on tries to prune the MySQL table to prevent bloat but this might still be too much for low-end hosting plans.
 
It should work OK, the add-on tries to prune the MySQL table to prevent bloat but this might still be too much for low-end hosting plans.
We'll be testing this properly soon, hopefully, so I'll report my findings once I do, thanks :)
 
  • Like
Reactions: Xon
How do I remove the X viewers from the thread title? Google is indexing the page title with that number for some reason.
 
This add-on has very few tunables, it is basically install redis and install the add-on. If you only want to use redis for this add-on, this can be done with the "cache context" that XF2.1+ supports.

This sort of configuration should work;
PHP:
$config['cache']['context']['userActivity']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['userActivity']['config']  = [
        'server' => '127.0.0.1',
        'port' => 6379,
];

I strongly recommend using a caching provider (memcache or redis) for the main cache section.
How would the configuration look if I wanted to dedicate a redis instance to just User Activity?
 
Top Bottom