How To Grab a List of Latest Threads

Beginners How To Grab a List of Latest Threads

LPH

Flight Director
Staff member
LPH submitted a new resource:

How To Grab a List of Latest Threads - Using a repository

Code:
/** @var \XF\Repository\Thread $threadRepo */
$threadRepo = \XF::app()->repository('XF:Thread');
$threadFinder = $threadRepo->findThreadsWithLatestPosts();

dump($threadFinder);

Next, you can do a loop to pull the threads

Code:
foreach ($threads = $threadFinder->fetch() AS $threadId => $thread) {
      // Your Code
}

Read more about this resource...
 
Top