Welcome to Geeklog, Anonymous Friday, April 26 2024 @ 01:35 am EDT
Geeklog Forums
Comment Notification?
Anonymous
Anonymous
In the notification array, can I add 'comment' to alert me when a comment has been contributed to a story? Also, a way to delete inappropriate comments?
Thanks again for a wonderful product and your continued support.
0
0
Quote
Anonymous
Anonymous
I am looking for comment notification also. Are there any plans to
add this option in the next build?
1
0
Quote
Fernando Ipar
Anonymous
I've made this quick fix, which can be set up with cron to check for new comments and notify you through e-mail.
Someone with more geeklog knowledge could probably have it create a proper url with a link to the new comments:
<?php
require "config.php";
# this is a text file where I store the last seen number of comments
define('CNT_FILE','/path/to/geeklog/geeklog_comments');
# this is the destination e-mail for notifications
define('DESTINATION','your@email.com');
$link = mysql_pconnect($_DB_host, $_DB_user, $_DB_pass);
mysql_select_db($_DB_name,$link);
$res = mysql_query("select count(*) as cnt_comments from ".$_DB_table_prefix."comments");
$cnt = 0;
if (file_exists(CNT_FILE)) {
$cnt = file_get_contents(CNT_FILE);
}
$arr = mysql_fetch_assoc($res);
if ($cnt < $arr["cnt_comments"]) {
file_put_contents(CNT_FILE,$arr["cnt_comments"]);
$rs = mysql_query("select distinct sid from ".$_DB_table_prefix."comments where cid > ".$cnt." order by date desc");
$msg = "There are new comments in the following stories: ";
while ($arr = mysql_fetch_assoc($rs)) {
$msg .= $arr["sid"];
}
mail(DESTINATION,"new geeklog comment",$msg);
}
mysql_close($link);
Text Formatted Code
<?php
require "config.php";
# this is a text file where I store the last seen number of comments
define('CNT_FILE','/path/to/geeklog/geeklog_comments');
# this is the destination e-mail for notifications
define('DESTINATION','your@email.com');
$link = mysql_pconnect($_DB_host, $_DB_user, $_DB_pass);
mysql_select_db($_DB_name,$link);
$res = mysql_query("select count(*) as cnt_comments from ".$_DB_table_prefix."comments");
$cnt = 0;
if (file_exists(CNT_FILE)) {
$cnt = file_get_contents(CNT_FILE);
}
$arr = mysql_fetch_assoc($res);
if ($cnt < $arr["cnt_comments"]) {
file_put_contents(CNT_FILE,$arr["cnt_comments"]);
$rs = mysql_query("select distinct sid from ".$_DB_table_prefix."comments where cid > ".$cnt." order by date desc");
$msg = "There are new comments in the following stories: ";
while ($arr = mysql_fetch_assoc($rs)) {
$msg .= $arr["sid"];
}
mail(DESTINATION,"new geeklog comment",$msg);
}
mysql_close($link);
0
0
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Just wanted to point out that the start of this thread is 5 years old 8)
Comment notifications are part of Jared's Summer of Code project. Alternatively, you could install Mike's plugin for comment feeds.
bye, Dirk
Comment notifications are part of Jared's Summer of Code project. Alternatively, you could install Mike's plugin for comment feeds.
bye, Dirk
0
0
Quote
All times are EDT. The time is now 01:35 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content