Silmarillion
Active member
Yes ist can. I've already figured it out myself.I noticed the following thing that bothers me: the number of readers is included in the search engine results. That doesn't look really nice. Can that be prevented?
Yes ist can. I've already figured it out myself.I noticed the following thing that bothers me: the number of readers is included in the search engine results. That doesn't look really nice. Can that be prevented?
node_name
set, the activity is not being tracked as param node_id
ist not set in this caes when calling XF\Repository\SessionActivity::updateSessionActivity
forum_view
?<h3 class="block-minorHeader">{{ phrase('svUserActivity_users_who_are_viewing_this_x', {'content_type': $contentTypePhrase|to_lower}) }}</h3>
The code actually extracts the observed node_id(s) from the Response's View::getParam variables, and doesn't actually parse it out of the arguments that go into the action.I think I've discovered a little bug:
If a node does have anode_name
set, the activity is not being tracked as paramnode_id
ist not set in this caes when callingXF\Repository\SessionActivity::updateSessionActivity
The code for viewing user activity in a container (vs the thread/conversation/etc) wasn't an initial goal and was only added after a paid request.Would it be possible to add a setting to choose the location for templateforum_view
?
Could probably use the existing setting with some rewording.
<xf:macro template="UA_ViewContainer_macros"
name="UserActivity"
arg-contentTypePhrase="{{ phrase('forum') }}"
arg-records="{$UA_Records}"/>
My recommendation is just translateIt seems impossible to properly translate this into german:Code:<h3 class="block-minorHeader">{{ phrase('svUserActivity_users_who_are_viewing_this_x', {'content_type': $contentTypePhrase|to_lower}) }}</h3>
In german, the first letter of the content type name needs to be uppercase as it is a noun.
Furthermore, translation depends on the grammatical gender ("genus") of the noun - Thema (thread) for example is neutral whereas conversation is female (if translated as Unterhaltung or Konversation).
Would it be possible to change this so an individual phrase is being used for each content type?
That would allow to translate this properly![]()
svUserActivity_users_who_are_viewing_this_x
as not actually mentioning the current content type which is one thing I've actually been considering.Hmm, maybe I am missing smth.?The code actually extracts the observed node_id(s) from the Response's View::getParam variables, and doesn't actually parse it out of the arguments that go into the action.
class SessionActivity extends XFCP_SessionActivity
{
/**
* @param int $userId
* @param $ip
* @param string $controller
* @param string $action
* @param array $params
* @param string $viewState enum('valid','error')
* @param string $robotKey
*/
public function updateSessionActivity($userId, $ip, $controller, $action, array $params, $viewState, $robotKey)
{
/** @var \SV\UserActivity\Repository\UserActivity $userActivityRepo */
$userActivityRepo = \XF::repository('SV\UserActivity:UserActivity');
$visitor = \XF::visitor();
if ($userActivityRepo->isLogging() && $viewState == 'valid' && $userId === $visitor->user_id)
{
$handler = $userActivityRepo->getHandler($controller);
if (!empty($handler))
{
$requiredKey = $handler['id'];
if (!empty($params[$requiredKey]))
{
$userActivityRepo->bufferTrackViewerUsage($handler['type'], $params[$requiredKey], $handler['activeKey']);
}
$handler
would be[
'controller' => 'XF\Pub\Controller\Forum',
'type' => 'node',
'id' => 'node_id',
'actions' => ['forum'],
'activeKey' => 'forum',
]
$handler
is not empty it would take $handler['id']
(= node_id
) as the $requiredKey
to look up in $params
.node_name
set, $params['node_id']
would be empty as only $params['node_name']
ist set in this case so $userActivityRepo->bufferTrackViewerUsage
never does get called?After more review, this does looks to be a bug. There where some XF2.0 like handling which wasn't updated to XF2.1 too.As$handler
is not empty it would take$handler['id']
(=node_id
) as the$requiredKey
to look up in$params
.
But if the node does have anode_name
set,$params['node_id']
would be empty as only$params['node_name']
ist set in this case so$userActivityRepo->bufferTrackViewerUsage
never does get called?
- php 7+ type hinting
- Force global namespace for functions which are known to be optimizable to bytecode in php, or known global functions to avoid a current namespace lookup for the function.
- Fix forum activity not registering as expected when a node_name is set on the forum
- Fix logging XF2.1+ reaction events as thread activity & remove old XF2.0 like handling for posts.
- Replace single
svUserActivity_users_who_are_viewing_this_x
phrase with various...
Is this just during the upgrade if so that is expected.Getting a ton of these since update
- LogicException: Macro public:UA_ViewContainer_macros :: UserActivity() error: Macro argument contentTypePhrase is required and no value was provided
- src/XF/Template/Templater.php:896
- Generated by: Unknown account
- Aug 24, 2021 at 7:13 AM
Check that theEven after
Stack trace
#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/l1/s12/public/thread_view.php(948): 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('thread_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:Thread\\View', 'public:thread_v...', 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}
UA_ViewContainer_macros
template isn't out of date, as it you probably have customizations which need merging.That was it, thanks!Check that theUA_ViewContainer_macros
template isn't out of date, as it you probably have customizations which need merging.
We use essential cookies to make this site work, and optional cookies to enhance your experience.