1. 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?

Discussion in 'XenForo Development Discussions' started by Despair, Jul 1, 2011.

  1. Despair

    Despair Active Member

    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.
     
  2. Jeremy P

    Jeremy P Well-Known Member

    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();
    }
     
  3. Despair

    Despair Active Member

    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.
     
  4. Despair

    Despair Active Member

    Anyone else have any ideas?
     
  5. xfrocks

    xfrocks Well-Known Member

    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
     
  6. Despair

    Despair Active Member

    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);
        }
     

Share This Page