2014-03-04, 02:43 PM
Hi,
I'm trying to make a simple plugin that sends email notification about a new thread to a specified email address. I can get the email sent, but have problems with including the thread URL to the email.
Here's what I have so far
So how do I capture the thread URL?
I'm trying to make a simple plugin that sends email notification about a new thread to a specified email address. I can get the email sent, but have problems with including the thread URL to the email.
Here's what I have so far
$plugins->add_hook('datahandler_post_insert_thread', 'emailonnewpost_send_thread');
function emailonnewpost_send_thread(&$data)
{
global $mybb;
$username = $mybb->user['username'];
if ($username != "Alex") {
$thread_url = ??;
$to = '[email protected]';
$subject = 'New Thread in My Forum';
$message = 'There was a new thread in My Forum: '.$thread_url.'';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
}
So how do I capture the thread URL?