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

Pulled threads are repeating the last ...


Well-known member
RESOLVED: There was a missing anchor being closed.

This is the code I've been using but realized the last post is being repeatedly pulled - up to 3 times:

    <div class="forum_posts one-third">  
      <h3>latest posts from our community</h3>
      /* Script to pull the latest posts from the XF Forum */  
       $nodeModel = XenForo_Model::create('XenForo_Model_Node');
      $db = XenForo_Application::getDb();
      if (!$db) {
      die('This script did not connect to the database' . mysql_error());
      $thread_qry = "
        SELECT thread_id, title, last_post_date FROM `xf_thread`
        ORDER BY `last_post_date` DESC
        LIMIT 5
      $threads = XenForo_Application::get('db')->fetchAll($thread_qry);
      foreach ($threads AS $thread) {
      echo ("<div class='entry-meta'><a href='http://www.tuxreports.com/community/" . XenForo_Link::buildPublicLink('threads', $thread) . "'>" . XenForo_Helper_String::wholeWordTrim($thread[title], 40) . "</div>");
This gives rise to :

<div class="forum_posts one-third">
<div class="entry-meta">
<a href="http://www.tuxreports.com/community/threads/the-changing-roles-of-u-s-soldiers-in-afghanistan.519208/"></a>
<a href="http://www.tuxreports.com/community/threads/the-changing-roles-of-u-s-soldiers-in-afghanistan.519208/"></a>
I keep looking at the PHP and trying to figure out why the same forum posts are being pulled. Can anyone point me in the right direction? Do you see an obvious error that causes this repetition?

You can see it live on www.tuxreports.com in the footer - right side. The left side pulling resources works fine.
Last edited: