MyBB Community Forums

Full Version: Posts are going to top of thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello MyBB Community,

I have a system that auto updates new posts and generates the new post for all users browsing the forum. This can be seen as a realtime post system. This requires appending the latest post to the bottom of the last post seen. My problem here is that when I append to the bottom of the $("#posts") using javascript it sends the new posts to the bottom of the first post on top of the current page.

My postbit is quite modified so I think the problem lies there hence I will add the relevant bits below.

showthread template:
<tr><td id="posts_container">
	<div id="posts">
		{$posts}
	</div>
</td></tr>

postbit template:
{$ignore_bit}{$deleted_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="post {$unapproved_shade}" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">

	<tr>
// ... postbit design below

I have tried creating a separate div for class="post" but this did not work as expected. td#posts_container has all the posts within however div#posts only has the top post within. The same issue happens using MyBB's quick reply so I had to disable it. Quick edit does not work either from most likely the same problem.

I append to div#posts using the following js:
$("#posts").append('<a name="pid'+pid+'" id="pid'+pid+'"></a><div class="post" id="post_'+pid+'" ...[postbit design]...></div>

I do think the problem can be solved with this information but if I am missing something I will do my best to provide such things.

Thank you, any help would be dearly appreciated.

Fixed all problems shortly after posting. Reason was bad postbit template as expected. Went back to zero and did everything step-by-step. Posts append correctly, quick edit, quick reply all work now.