MyBB Community Forums

Full Version: Replacing first post's content on quick reply.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I need to replace first post's content dynamically after ajax/quick reply.

I'm able to do it by using $post['message'] and replacing it's value but the thing is it's replacing all posts but first.

Any code or way to only do it for first post?

Thank you.
Use postcounter to make changes to a specific post.

if (($postcounter) == 1) {

etc..........
Already did. This is the pattern I'm using, also tried replacing it with several others, but it's not getting to work.

if ($postcounter == 1) {
	if($mybb->input['ajax'])
	{
	
	$post['message'] = "The content here needs to be dynamically replaced on first post.";
	
	}
	}
$global $mybb, $postcounter;

if (($postcounter) == 1) {
        $post['message'] = "The content here needs to be dynamically replaced on first post.";
}
Haha, I already had $postcounter defined as globals as I was using it prior to this piece of code as well.

The thing is, when you put it with checking ajax (checking for quick reply), it will replace the post which we just posted and not the first one.

I'm hooking into postbit, if that's what you're asking.
You have to append it or prepend it thats why.

$post['message'] .= "The content here needs to be dynamically replaced on first post.";
I'm now appending, doing no changes now. Would I need to hook at some other place or I can hook into postbit and check for ajax input (because the latter is what I'm doing right now).
Can you post your entire code or pm it to me if you'd rather not display it publicly ?
Sure, I sent a PM.

Thank you.
(2012-11-30, 02:17 PM)Frank.Barry Wrote: [ -> ]
$global $mybb, $postcounter;

if (($postcounter) == 1) {
        $post['message'] = "The content here needs to be dynamically replaced on first post.";
}

You don't have to use dollar sign infront of global. Nor you need to use $mybb as global object since its not being used here. However you need to use $post as a reference.

@Unadkat: Are you trying to erase/remove the "first" post content when it "multiquoted" in quickreply? If so then you may get an idea from hide until post. See the last function the author did there.
Pages: 1 2 3