Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2002
Posts: 27
User
User
Offline
Joined: Jun 2002
Posts: 27
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.

Modify your addpost.php and goto
// ---------------------------------------------
// Update the total post if the post is Approved
if ($Approved == "yes") {


and add this code right above
code:

// Send an Email to the Subscribers if they are Subscribed to this board
if ($Approved == "yes") {
$query = "
SELECT U_Email,
U_Language
FROM w3t_Users
LEFT JOIN w3t_Subscribe ON U_Username = S_Username
WHERE S_Username = U_Username
AND S_Board = '$Board_q'
";

$sth = $dbh -> do_query($query);

while ( list($Mailto,$Language) = $dbh -> fetch_array($sth) ) {
// -------------------------------------------=
// We need to make sure this user still exists
if ($Mailto) {

// -----------------------------------------------------------------
// Now if this user has a pre-selected language we use that language
// for the message we send out
if (!$Language) { $Language = $config['language'];}
require "{$config['path']}/languages/$Language/addpost.php";

$EmailBody = $Body;
if ($config['stripcodes']) {
$EmailBody = preg_replace("/<([^>])*>/","",$EmailBody);
}

$newline = "\n";
if (stristr(PHP_OS,"win")) {
$newline = "\r\n";
}

$to = $Mailto;
$mailer = new mailer;
$header = $mailer -> headers();
$subject = "New Post To $Title from $postername";
$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";

mail("$to","$subject",$msg,$header);

// --------------------------------------------------
// Now, we need to switch back to this users language
$Language = $user['U_Language'];
if (!$Language) { $Language = $config['language']; }
require "{$config['path']}/languages/$Language/addpost.php";
}
}
}


Last edited by Lunatik; 06/20/2002 12:20 PM.
Sponsored Links
Entire Thread
Subject Posted By Posted
Email to Subscribes for New Posts Lunatik 06/20/2002 6:10 PM
Re: Email to Subscribes for New Posts Lunatik 06/20/2002 6:34 PM
Re: Email to Subscribes for New Posts AllenAyres 06/20/2002 11:46 PM
Re: Email to Subscribes for New Posts Lunatik 06/21/2002 8:31 AM
Re: Email to Subscribes for New Posts AllenAyres 06/21/2002 6:46 PM
Re: Email to Subscribes for New Posts Lunatik 06/22/2002 5:46 AM
Re: Email to Subscribes for New Posts Lunatik 06/24/2002 7:05 PM
Re: Email to Subscribes for New Posts Lunatik 07/05/2002 3:46 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)