• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

getSessionActivityDetailsForList for Extended Member Controller?

Despair

Active member
#1
I've extended the member controller and have a URL like /members/user/content which works nicely. However, if a user is viewing that URL, in their last activity it will show that they are viewing that particular user's profile. I would prefer it to say something like, "Viewing User X's Content". In my own controller that extends the member controller it doesn't look like I can use getSessionActivityDetailsForList. How should I go about doing this? Thanks.
 

Jeremy P

Well-known member
#2
Something like this should work, no?

PHP:
public static function getSessionActivityDetailsForList()
{
foreach ($activities AS $key => $activity)
{
$action = $activity['controller_action'];

switch ($action)
{
case 'Content':
return new XenForo_Phrase('example_viewing_content');
}
}

return parent::getSessionActivityDetailsForList();
}
 

Despair

Active member
#3
Yea, already tried that, it's not taking effect at all. I tried dumping the variable and exiting, but the function isn't being run, it's still using the getSessionActivityDetailsForList from the default member controller.
 

xfrocks

Well-known member
#5
You probably will need to extends XenForo_Model_Session and make use if this

PHP:
public function addSessionActivityDetailsToList(array $activities)
You can't use 'getSessionActivityDetailsForList' because it was called statically
 

Despair

Active member
#6
Thanks for giving me something to try. I didn't have much luck extending the session though. Instead I noticed in the db it was storing the XenForo_ControllerPublic_Member as the controller_name so I figured I needed that part changed to store my own controller and found an updateSessionActivity method. Not sure if I should use it for this purpose but it seems to be working now:

Code:
    public function updateSessionActivity($controllerResponse, $controllerName, $action)
    {
        return parent::updateSessionActivity($controllerResponse, __CLASS__, $action);
    }