Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: SwissRed - tammikuu 08, 2006, 07:39:27 AP

Otsikko: How to add extra code to Post button
Kirjoitti: SwissRed - tammikuu 08, 2006, 07:39:27 AP
Hi

I want to add an extra code to the post button in the Post Reply page. I want the post to send to an email everytime when the board id is say 20. How shall i go about doing this?
Otsikko: Re: How to add extra code to Post button
Kirjoitti: SwissRed - tammikuu 08, 2006, 01:42:37 IP
OK. I found the answer after get more info in the forum. To share with you:

Find this code in Post.php

Lainaa// This is a new topic or an already existing one. Save it.
   else
   
         createPost($msgOptions, $topicOptions, $posterOptions);

and add the following like this:

Lainaa// This is a new topic or an already existing one. Save it.
   else
   {
      if ($board == 12)
      {
         $to      = '[email protected]';
         $subject = $_POST['subject'];
         $message = $_POST['message'];
         $headers = 'From: [email protected]' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();
         mail($to, $subject, $message, $headers);
      }

      createPost($msgOptions, $topicOptions, $posterOptions);

And that is it. $Board == 12 because i only want reply from this board to send the email everytime to me.

Hope this helps someone.
Otsikko: Re: How to add extra code to Post button
Kirjoitti: Gargoyle - tammikuu 08, 2006, 01:45:15 IP
That's pretty cool... This would be very useful if you had a site problems board so you would get an e-mail notification of a new post to that board.

No I am wondering if there isn't a built in feature that will do this...... ??