MyBB Community Forums

Full Version: How to get last post author and total post count from single thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using a plugin called mybb postalicious for wordpress which I've modified for my needs however I am failing to grasp the mysql portion how its reading out the latest threads per tid and thread title.

In a nutshell:

$sql = 'select tid, subject from '
				. $options['db_prefix'] . 'threads' // sanitized in MyBBXPSettings
				. ' where fid in( '
				. $instance['fids'] // sanitized below
				. ') order by '
				. ($instance['define_recent'] == 'created' ? 'dateline' : 'lastpost') // sanitized below and inline
				. ' desc limit '
				. $instance['num_topics'] // sanitized below
				. ';';
		$threads = $mybbdb->get_results($sql);

Then using that does:

		echo '<div class="widget-item2">';
		foreach ($threads as $thread) {
			echo '<div class="mybbitems">
			<a href="/forum/?tid='.$thread->tid.'"><img src="http://mywebsite.com/images/newfolder.gif" class="thumb2"></a>
			<h3><a href="/forum/?tid='.$thread->tid.'" title="'.$thread->subject.'">'.$thread->subject.'</a></h3>
			</div>';
		}
		echo '</div>';
		
		echo $after_widget;

Which passes the TID to my forum template page which is embedded in the design as an iframe and then using the tid passed through opens the forum thread via the tid instead of the default forum front page. This is meaningless but anyways thats what it does, what interests me is how it gets the tid and the thread subject?

I would like to get last thread poster name and that thread total post count.

Also curious how to get original thread creation date and last post in that thread date
Anyone? Sad