| Author |
Post |
|
|
#1 Mon May 21, 2007 10:00 am
|
|
Member
Registered: Feb 2007
Posts: 6
|
Hi,
I searched the board about this topic and found nothing. So I suggest an e-mail notification system if a new post is posted in the forum. I think a configurable notification system would be very nice, e. g. notification only if a new topic is started, general notification, notification only category-specific and so on. I think an e-mail notification would help some people to know, that they are a member of a community... So if a new member is registered, e-mail notification should be automatically enabled.
|
|
|
#2 Mon May 21, 2007 10:18 am
|
|
Member
Registered: Apr 2007
Posts: 15
Location: Amsterdam, Netherlands
|
The subscription feature already works with email notification.
|
|
|
#3 Mon May 21, 2007 1:23 pm
|
|
Developer
Registered: Apr 2004
Posts: 2191
Location: Belgium
|
But not for forums.
Enabling it by default would be a very bad idea, if you are on a forum with several hundred posts per day you will end up with perhaps 1000 e-mail messages in a week per member.
|
|
|
#4 Wed May 23, 2007 4:42 pm
|
|
Member
Registered: Feb 2007
Posts: 6
|
Well,
I have a small forum (max = 4 post/week) so I think this function should be enabled by the admin or the user himself. I think, the admin should be able to configure an "automatic enabled/disabled for new member" email notification. If the new member doesn't want this, he/she should be able to disable this feature himself.
|
|
|
#5 Tue Jun 03, 2008 8:13 pm
|
|
Member
Registered: Jun 2008
Posts: 2
|
Hi! I've got the same problem, so i coded a little quick 'n dirty Perl Script which does the job: #!/usr/bin/perl
use strict; use DBI; use Net::SMTP;
#### Konfig my $dbhost = "localhost"; my $dbname = "forum"; my $dbuser = "your-user-here"; my $dbpassword = "xxxxxxx";
my $mailserver = "mail.example.com"; my $mailfrom = 'forumNotify@example.com'; my $subject = "New Forum Post at example.com";
my $forum_url = "http://www.example.com/forum/";
# Print Debug infos? [0|1] my $debug = 0;
## Look every X Minutes for new Posts: my $look_every = 5; # Minutes
##########
my $dsn = ""; my $dbh = ""; my $sth = ""; my $max_time = 0; my %posts = (); my %recipients = ();
$dsn = "DBI:mysql:database=$dbname;host=$dbhost"; $dbh = DBI::->connect( $dsn, $dbuser, $dbpassword ) or die DBI::errstr;
$max_time = time - ($look_every * 60);
$sth = $dbh->prepare( qq~ SELECT `usebb_posts`.`id`, `usebb_posts`.`topic_id`, `usebb_posts`.`poster_id`, `usebb_topics`.`topic_title` , `usebb_members`.`name` , `usebb_posts`.`content` FROM `usebb_topics` , `usebb_members` , `usebb_posts` WHERE ((`usebb_topics`.`id` = `usebb_posts`.`topic_id`) AND ( `usebb_members`.`id` = `usebb_posts`.`poster_id`)) AND `usebb_posts`.`post_time` >= $max_time ~ ); $sth->execute(); while( my( $id, $topic_id, $poster_id, $title, $name, $content ) = $sth->fetchrow_array()) { $posts{$id} = { id => $id, topic_id => $topic_id, poster_id => $poster_id, content => $content, short_content => substr($content, 0, 60), title => $title, name => $name, }; }; $sth->finish();
if( $debug ) { print "============\n"; foreach my $key (sort keys %posts) { print "Key: $key\nTitle: $posts{$key}{'title'}\nPoster: $posts{$key}{'name'}\nCont: $posts{$key}{'short_content'}...\n"; }; print "============\n\n"; };
$sth = $dbh->prepare(qq~ SELECT `id` , `name` , `email` FROM `usebb_members` WHERE `active` = 1 ~); $sth->execute(); while( my( $id, $n, $e) = $sth->fetchrow_array() ) { $recipients{$id} = { name => $n, email => $e, }; }; $sth->finish();
if( $debug ) { print "============\n"; foreach my $key (sort keys %recipients) { print "Key: $key Name: $recipients{$key}{'name'} E-Mail: $recipients{$key}{'email'}\n"; }; print "============\n\n"; };
if( keys(%posts) > 0 ) { foreach my $key (sort keys %recipients) { my $smtp; $smtp = Net::SMTP->new($mailserver); $smtp->mail($mailfrom); $smtp->to($recipients{$key}{'email'}); $smtp->data(); $smtp->datasend("From: $mailfrom\n"); $smtp->datasend("To: $recipients{$key}{'email'}\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n");
foreach my $key (sort keys %posts) { my $link = $forum_url . "topic.php?post=$key#post$key"; $smtp->datasend("Topic: " . $posts{$key}{'title'} . "\n"); $smtp->datasend("Member: " . $posts{$key}{'name'} . "\n"); $smtp->datasend("Text: " . $posts{$key}{'short_content'} . "..." . "\n"); $smtp->datasend("Link: " . "$link" . "\n"); $smtp->datasend(" \n"); $smtp->datasend(" \n"); $smtp->datasend(" \n"); };
$smtp->dataend(); $smtp->quit(); }; };
Adjust the config variables and call the Script by crontab every $look_every minutes. HTH, chris
|
|
|
#6 Sun Jun 08, 2008 2:30 am
|
|
Member
Registered: Jun 2008
Posts: 2
|
Chris .... this is EXACTLY what I have been looking for as well. It works perfectly BUT (there is always a but) it does not seem to send email's if the poster does not login.
In my forum, I do not require the poster to login.
Is there a way to pick up these posts ??
thanks so much for this script,
Ron...
|
|
|
#7 Wed Jun 11, 2008 6:06 pm
|
|
Member
Registered: Jun 2008
Posts: 2
|
Hi rbur!
To implement your suggestion, i would need a dump of your database, because mine doesn't allow anonymous posting/reading.
I am not easily able to change that here in my Setup.
christian
|
|
|
#8 Wed Jun 11, 2008 9:13 pm
|
|
Member
Registered: Jun 2008
Posts: 2
|
Christian, ... thanks for the reply. Just yesterday, I "tweaked" the sql statement and got what I want. It has been under test since yesterday and so far seems to be giving me the desired results (more or less). Couple more days of testing should tell the tale. FYI.... the following change to your sql query is what I did. "YOURS" WHERE ((`usebb_topics`.`id` = `usebb_posts`.`topic_id`) AND ( `usebb_members`.`id` = `usebb_posts`.`poster_id`)) AND `usebb_posts`.`post_time` >= $max_time "MINE" WHERE (`usebb_topics`.`id` = `usebb_posts`.`topic_id`) AND `usebb_posts`.`post_time` >= $max_time I have commented out the datasend "member" statement because it is giving wrong name on anonymous posts. The posts table has a field called poster_guest which does carry the anonymous name (if they enter one). The poster_id field contains a "0" for the anonymous posters. I will try to place a simple if statement to see if I can get either a login poster or the anonymous poster name to show up in the member datasend statement. After that... I may try to tweak to send html mail... or by chance have you done that ?? Your code has given me a good start and more importantly ... allowed me to keep using UseBB. I was just starting to research other forum programs that might have this feature when chris0001's post and your VERY timely response came along. Judging from the number of views on this subject, I think many others may also be interested. Thanks again for your contribution .... Ron...
|