Quote:
Originally Posted by LloydApter
I get to this page when I tried making these updates:
Thanks for all your help
|
Check the postid. Below code checks postid is valid
Form Hook: Before Submit:
PHP Code:
if ($complete)
{
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
$postid = 245;
$postinfo = fetch_postinfo($postid);
if (!$postinfo)
{
$errormessage = 'Post doesn\'t exist, please alter line $postid = 245 ';
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
}
$postpagetext = str_replace('[/table]', "\r\n $formoutput [/table]", $postinfo[pagetext]);
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$postdm->set_existing($postinfo);
$postdm->set('pagetext', $postpagetext);
$postdm->pre_save();
if(count($postdm->errors) < 1)
{
$postdm->save();
}
else
{
foreach ($errors as $error)
{
$errorss .= $error. "<br />";
}
$errormessage = "Following errors occurred".$errorss;
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
}
unset($postdm);
if ($form[submitmessage])
{
$errormessage = $form[submitmessage];
}
else
{
$errormessage = "Form was submitted successfully. Click <a href=\"showthread.php?" . $vbulletin->session->vars['sessionurl'] . "p=" . $postinfo[postid] . "#post" . $postinfo[postid] . "\">here</a> to view the post.";
}
}