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

Can I pass data from action function to getSessionActivityDetailsForList ?

Discussion in 'XenForo Development Discussions' started by cmpe, Aug 11, 2016.

  1. cmpe

    cmpe Active Member

    I have custom ControllerPublic class that extends XenForo_ControllerPublic_Abstract and within it, I have various actionXYZ functions.

    Is there a way to pass data from within one of the actionXYZ functions to the getSessionActivityDetailsForList function?

    I have all the data I need in the action function but can't seem to be able to pass it off to the $activities array for getSessionActivityDetailsForList.
  2. Snog

    Snog Well-Known Member

    Look at ControllerPublic/Thread.php and how the data is built in it's getSessionActivityDetailsForList.
  3. cmpe

    cmpe Active Member

    I did look at this but because I already queried the DB in my action function to retrieve the data I want to show in the activity list, I didn't want to have to call it again. :confused:
  4. Mike

    Mike XenForo Developer Staff Member

    The short answer is that you need to. getSessionActivityDetailsForList isn't called in the same context as your action. It only has access to basic input to identify the content in question.
  5. cmpe

    cmpe Active Member

    Thanks Mike. I was actually dreaming about xenforo code last night just because I've been trying to figure this out. :D

    Makes sense, since the function is called statically and the action functions are non-static.

    So I guess re-working the problem a little bit, is there a way I can add to the $activities parameter somewhere so that by the time getSessionActivityDetailsForList is called, I'll have the data available in that variable of the function?


Share This Page