XF 2.2 Controller Post Dispatch to add an additional params on thread load

Gobb

Member
Hi,

Just wanting to know if there are any real negatives to hooking into the controller post dispatch functionality to add additional params which are obtained via SessionActivity repository/finder/entity? I understand ideally I would be extending the Index action of the Thread parent. However, I'm just making a simple 'user's viewing the thread' addon for XF2 for a forum with approx 10 users on at any one time and extending the Index action doesn't display the user clicking into the thread on initial load. However, it works correctly by extending the controller post dispatch as this allows the data to be fetched after the user activity has been updated. As far as I can tell querying the session activity table instead of making and maintaining another table makes the most sense in my case?

Or is this method of adding additional params not really best practice/correct?

Any guidance would be appreciated,

Thanks
 
For that specific use case, I'd suggest to just stick with the controller extension and add the user to the retrieved collection manually, since you know as a fact that he's visiting the thread at the moment. Alternatively, you can just never fetch him to begin with and adjust the display element to spell out "You, User X, User Y and User Z" instead (or hardcode their avatar in).
 
For that specific use case, I'd suggest to just stick with the controller extension and add the user to the retrieved collection manually, since you know as a fact that he's visiting the thread at the moment. Alternatively, you can just never fetch him to begin with and adjust the display element to spell out "You, User X, User Y and User Z" instead (or hardcode their avatar in).
Can't believe I didn't even think of that lol, cheers.
 
Top Bottom