Quote:
Originally Posted by tehtide
Is there a way that we could PM a notification to a different user on our forums when this form has been submitted?
Right now I'm using this as an application on our website. When the form is completed a poll is created in a forum that the submitting user cannot access. However I'd like the ability to shoot a notification pm off to another user in the forum to let them know that a new application has been submitted. Is there any easy way of doing this?
|
Form hook, before submit
PHP Code:
global $vbulletin, $botpermissions;
$fromuserid = $vbulletin->userinfo['userid'];
$fromusername = $vbulletin->userinfo['username'];
$title = $threadtitle;
$recipients = "ADMIN";
$message = "New application [url=http://google.com]here[/url]";
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', $fromuserid);
$pmdm->set('fromusername', $fromusername);
$pmdm->set('title', $title);
$pmdm->set('message', $message);
$pmdm->set_recipients($recipients, $botpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->overridequota = true;
$errors = $pmdm->errors;
if ($errors)
{
foreach ($errors as $error)
{
$errorss .= $error. "<br />";
}
$errormessage = "Form failed to submit. The following error(s) occured: <br /> ".$errorss;
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
}
$pmdm->save();
unset($pmdm);