XF 2.2 Is there a way to fetch details about who is viewing a page?

asprin

Active member
Licensed customer
My addon has the following controller

PHP:
public function actionFoo()
{
    $viewParams = ['someVariableThatHoldsInformation' => <fetch the details here>];
   
    return $this->view('Asprin\CB:Foo', 'aspcb_my_template', $viewParams);
}

Aim is to have the following in the template
HTML:
<div>
    Users viewing this page: {$someVariableThatHoldsInformation}
</div>

If I had to show users who are currently on page aspcb_my_template, how do I get that info in my controller?
 
There is nothing built-in for this use case. Some information is stored on xf_session_activity, but the schema is not designed for extracting this information and trying to do so will perform terribly. There is an add-on by Xon which implements this functionality in a content-agnostic way (other add-ons may integrate with it): https://xenforo.com/community/resources/user-activity-by-xon.5567/
 
Solution
Back
Top Bottom