Basically, I'm coding a page that will allow me to administer posts within the boards from an easier control panel.
One of the tools would allow the moderator to deduct points from a user and add a simple line at the end of the post that tells the member he was penalized.
The issue I'm having is simply this:
Querying the DB to retrieve the post, parse the post to contain only BBCode and line breaks and saving it to the database is no problem.
When I get on IPBoard to view the message though, the post content itself will show the content with BBCode instead of formatting it. I'd have to proceed and click on "Edit" and then simply click "Save" and the post then appears fine.
Is there something that needs to be done for IPBoard to display the post correctly without the need to do that?
I noticed there were other fields in the ibf_posts table which I don't know what their purpose are...
Here's part of my code:
//Parse the topic ID
$postURL = trim($_POST['post_url']);
$parsedTopic = str_replace("http://www.dgemu.com/forums/index.php?/topic/", "", $postURL);
$removeEnd = strpos($parsedTopic, "-");
$parsedTopic = substr($parsedTopic, 0, $removeEnd);
//Parse the post ID
$removeFront = strrpos($postURL, "_") + 1;
$setEnd = strlen($postURL);
$parsedPost = substr($postURL, $removeFront, $setEnd);
//Update the post
$post = $ipbwi->post->info($parsedPost);
$ipbwi->ips_wrapper->DB->query("SELECT author_id, post FROM ibf_posts WHERE pid=" . $parsedPost . " AND topic_id=" . $parsedTopic);
if($post = $ipbwi->ips_wrapper->DB->fetch())
{
if($post['author_id'] == $memberId)
{
//Note: <br /><br /> tags needed to reproduce 1 carriage return due to IPBoard bug.
$modifiedPost = nl2br($post['post']) . "<br /><br /><br /><br />[b][color=#ff0000]" . $staffName . " deducted " . $GPmodifier . "GPs for this post.[/color][/b]";
$modifiedPost = br2nl($modifiedPost);
$ipbwi->post->edit($parsedPost, $ipbwi->bbcode->html2bbcode($modifiedPost), false, false, false, false);
}
}
Note: br2nl is a function that will replace the double <br /> tags generated from IPBoard into a simple return carriage \rNote 2: Using the $ipbwi->post->info() function to retrieve a post gives the exact same output problem.
Edited by mm21xx, 24 January 2012 - 09:57 PM.













