abdfahim
Well-known member
I selected few thread_id based on certain criteria. Now I want to get the thread, forum and user entities for all those IDs. But in the XF2 doc, I don't see "IN" in the supported operator list for the Finder system. Is there any way to do that?
Code:
$values = $this->db()->fetchAllKeyed("
SELECT
xf_post.thread_id,
count(xf_post.post_id) totalNewPost
FROM xf_post
WHERE
xf_post.post_date > UNIX_TIMESTAMP(DATE_SUB(now(), INTERVAL 7 DAY))
GROUP BY xf_post.thread_id
HAVING totalNewPost > 0
ORDER BY totalNewPost DESC
LIMIT 5", "thread_id");
$threads = $this->finder('XF:Thread')
->with(['Forum', 'User'])
->where('thread_id', 'IN', array_keys($values));
Last edited: