MyBB Community Forums

Full Version: Last post ID ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I need to know how to get the last post ID,
I am modifying some plugin and I need the last post ID
Ex: If there are 10 replies in a thread then i need the ID of the 10th post dynamically

or

How to get the last post number ?

Can somebody please help me out on that ?

P.S : Same post is made at here but didnt get reply please delete, sorry for re post.
$thread['lastpost']
get_thread($tid)['lastpost']
select lastpost from mybb_threads where tid=$tid
AH....I think i didnt do it right... can you please help ?

function postad_start($post)
{
	global $postcounter,$mybb,$thread,$tid;
	If ($mybb->settings['postad1'] == 1)
	{
		if ($postcounter == "1")
		
			{
				$ads= $mybb->settings['postad3'];
				$post['message'] = "<div style=\"float:right;\">{$ads}</div>{$post['message']}<div style=\"clear:both;\">";
			}
	}	
}
This is the code, what i want is the the line of post counter to be replaced by last post.
Now its checking the first post and then executing the code below but I want to execute the code in the last post of the thread.

can you please help me out !!!
Help would be much appreciated.
No help yet Sad
Can somebody help me please ?
I am struggling with this for past 3 days Sad
yet no help Sad
I got it after some trail and error.

Oh here is the code I wrote to get it, writing because it might help somebody.
above this function in global $thread should be added
next in post count line
if ($postcounter == $thread['replies']+1)


Thread can be closed.