php forum
php mysql forum
php mysql smarty
 
Topic Options
#219445 - 06/20/02 11:10 AM Email to Subscribes for New Posts
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
I added some code that will allow for people to use the subscription option to get email on new posts when they get submitted instead of the daily report. <br /> <br />Modify your addpost.php and goto <br />// --------------------------------------------- <br />// Update the total post if the post is Approved <br /> if ($Approved == "yes") { <br /> <br /> <br />and add this code right above <br /><pre><font class="small">code:</font><hr> <br />// Send an Email to the Subscribers if they are Subscribed to this board <br />if ($Approved == "yes") { <br /> $query = " <br /> SELECT U_Email, <br /> U_Language <br /> FROM w3t_Users <br /> LEFT JOIN w3t_Subscribe ON U_Username = S_Username <br /> WHERE S_Username = U_Username <br /> AND S_Board = '$Board_q' <br /> "; <br /> <br />$sth = $dbh -> do_query($query); <br /> <br />while ( list($Mailto,$Language) = $dbh -> fetch_array($sth) ) { <br /> // -------------------------------------------= <br /> // We need to make sure this user still exists <br /> if ($Mailto) { <br /> <br /> // ----------------------------------------------------------------- <br /> // Now if this user has a pre-selected language we use that language <br /> // for the message we send out <br /> if (!$Language) { $Language = $config['language'];} <br /> require "{$config['path']}/languages/$Language/addpost.php"; <br /> <br /> $EmailBody = $Body; <br /> if ($config['stripcodes']) { <br /> $EmailBody = preg_replace("/<([^>])*>/","",$EmailBody); <br /> } <br /> <br /> $newline = "\n"; <br /> if (stristr(PHP_OS,"win")) { <br /> $newline = "\r\n"; <br /> } <br /> <br /> $to = $Mailto; <br /> $mailer = new mailer; <br /> $header = $mailer -> headers(); <br /> $subject = "New Post To $Title from $postername"; <br /> $msg = "$postername has posted a message to $Title: $newline{$config['phpurl']}/showthreaded.php?Cat=$Cat&Board=$Board&Number=$Mnumber$newline${newline}------Message Below------${newline}Subject: $FormSubject${newline}${newline}Message:$newline$EmailBody"; <br /> <br /> mail("$to","$subject",$msg,$header); <br /> <br /> // -------------------------------------------------- <br /> // Now, we need to switch back to this users language <br /> $Language = $user['U_Language']; <br /> if (!$Language) { $Language = $config['language']; } <br /> require "{$config['path']}/languages/$Language/addpost.php"; <br /> } <br /> } <br />} <br /></pre><hr>


Edited by Lunatik (06/20/02 12:20 PM)

Top
#219446 - 06/20/02 11:34 AM Re: Email to Subscribes for New Posts [Re: sari]
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
Also you might want to modify the editemail.php in the languages directory and change the line<br /><br />$ubbt_lang['SUB_STAT'] = "Subscription status for the following forums. (Receive a daily archive of all posts to this forum via your Real email address.)";<br /><br />to<br /><br />$ubbt_lang['SUB_STAT'] = "Subscription status for the following forums. (Receive an email on all posts to this forum via your Real email address.)";<br />

Top
#219447 - 06/20/02 04:46 PM Re: Email to Subscribes for New Posts [Re: sari]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
good one <img src="/forum/images/icons/smile.gif" alt="" /> Often requested...<br /><br />question, can it be turned off? Would hate to subscribe to a question/answer thread and it go on for 3-400 pages <img src="/forum/images/icons/crazy.gif" alt="" />
_________________________
- Allen wavey
- What Drives You?

Top
#219448 - 06/21/02 01:31 AM Re: Email to Subscribes for New Posts [Re: sari]
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
The way it is designed the user can go to "My Home" and unsubscribe to the board at anytime. Or if you wish to shut the whole thing down just edit your config and turn off subscriptions. <br /><br />The only thing I have to check on is if you turn off subscriptions does it clear the subscription table. Might have to look into that one.

Top
#219449 - 06/21/02 11:46 AM Re: Email to Subscribes for New Posts [Re: sari]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
ok, sounds good then <img src="/forum/images/icons/smile.gif" alt="" />
_________________________
- Allen wavey
- What Drives You?

Top
#219450 - 06/21/02 10:46 PM Re: Email to Subscribes for New Posts [Re: SurfMinister]
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
I did some testing. When you turn off subscriptions in the config settings it does not remove the users from the subscribe table, however it still sends an email to the people who are subscribed to the board. <br /> <br />I will add something to the code so that if the subscriptions is turned off it will quit sending emails on all posts.


Edited by Lunatik (06/21/02 10:46 PM)

Top
#219451 - 06/24/02 12:05 PM Re: Email to Subscribes for New Posts [Re: sari]
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
Here is the updated code for the subscriptions. If you globally disable subscriptions it will not send an email out.<br /><br /><pre><font class="small">code:</font><hr><br />// Send an Email to the Subscribers if they are Subscribed to this board<br />if (($Approved == "yes") && ($config['subscriptions'] == 1)){<br /> $query = "<br /> SELECT U_Email,<br /> U_Language<br /> FROM w3t_Users<br /> LEFT JOIN w3t_Subscribe ON U_Username = S_Username<br /> WHERE S_Username = U_Username<br /> AND S_Board = '$Board_q'<br /> ";<br /><br />$sth = $dbh -> do_query($query);<br /><br />while ( list($Mailto,$Language) = $dbh -> fetch_array($sth) ) {<br /> // -------------------------------------------=<br /> // We need to make sure this user still exists<br /> if ($Mailto) {<br /><br /> // -----------------------------------------------------------------<br /> // Now if this user has a pre-selected language we use that language<br /> // for the message we send out<br /> if (!$Language) { $Language = $config['language'];}<br /> require "{$config['path']}/languages/$Language/addpost.php";<br /><br /> $EmailBody = $Body;<br /> if ($config['stripcodes']) {<br /> $EmailBody = preg_replace("/<([^>])*>/","",$EmailBody);<br /> }<br /><br /> $newline = "\n";<br /> if (stristr(PHP_OS,"win")) {<br /> $newline = "\r\n";<br /> }<br /><br /> $to = $Mailto;<br /> $mailer = new mailer;<br /> $header = $mailer -> headers(); <br /> $subject = "New Post To $Title from $postername";<br /> $msg = "$postername has posted a message to $Title: $newline{$config['phpurl']}/showthreaded.php?Cat=$Cat&Board=$Board&Number=$Mnumber$newline${newline}------Message Below------${newline}Subject: $FormSubject${newline}${newline}Message:$newline$EmailBody";<br /><br /> mail("$to","$subject",$msg,$header);<br /><br /> // --------------------------------------------------<br /> // Now, we need to switch back to this users language<br /> $Language = $user['U_Language'];<br /> if (!$Language) { $Language = $config['language']; }<br /> require "{$config['path']}/languages/$Language/addpost.php";<br /> }<br /> }<br />}<br /></pre><hr>

Top
#219452 - 07/05/02 08:46 AM Re: Email to Subscribes for New Posts [Re: sari]
Lunatik Offline
User

Registered: 06/18/02
Posts: 28
I tested this with Version 6.0.2 and everything appears to be working the same without any furter modifications.

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks