HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Show last comment on discussion listing page
We are using the vanilla forum for building our community platform, So in our requirements, we will have a discussion listing page and if the discussion has any comment then we need to show along with it.
So is there any way using which we can introduce "lastcomment" data inside currently provided discussion list data?
We do not want to have extra loops and multiple queries to prepare this data, any way to make use of "join" in existing discussion model?
Any help will be very much appreciated.
0
Comments
Discussions and Comments are in two different tables. There wouldbe some kind of joint needed. There is no DiscussionModel method which fetches the discussion and additionally the most recent comment. That is a feature which is not required anywhere. Therefore you would have to do it by yourself.
I wouldn't know how to get the newest dataset from a table without a subquery. Therefore I would do 2 steps and use caching in order not to waste resources (which is your main concern, I guess)
This is only hacked down, I haven't had a look for permissions and such:
Okay, thanks for the inputs.