Page 1 of 1
All comments to central e-mail address
Posted: Wed Feb 14, 2007 8:09 am
by Mickel
Hello,
First of all I'd like to thank the developers of Serendipity for their job well done. I love the software and the way it has been created. I do have a question, though. Before posting here, I have tried to get an answer on my question with the search function, but I couldn't find a solution.
I would like my serendipity to send copies of ALL comments (not entries!) to a central e-mail address (the "admin" address?). Naturally I already receive the comments on entries that I create, but I'd like to keep track of ALL comments and comments to comments that ALL authors receive. In other words, each time someone sends a comment to an entry, I would like serendipity to send a copy of the e-mail that the original author receives to a central (admin?) address.
Would someone be able to and prepared to post the solution for making this happen here?
Thanks for your time and help...
- Mickel
Re: All comments to central e-mail address
Posted: Wed Feb 14, 2007 10:09 am
by garvinhicking
Hi!
Actually, s9y does not support this "out of the box", so you need to install a plugin to do that for you.
Luckily, such a plugin is VERY easy to do.
Just copy and paste the code below and save it inside /plugins/serendipity_event_mailcc/serendipity_event_mailcc.php. Then you go to your s9y admin panel, go to 'configure plugins', click on "click here to install an event plugin" and select the plugin "Adds CC to all sent emails" from the list. This will have a config screen where you can enter an email adress which will get each and every single email that s9y spews out.
This plugin has a simple caveat: E-Mails will only be sent, if the owner of an entry has "Send notification for comments" enabled. Else, an email will not be send, and thus you can't get a CC. To alter this functionality, changes in the core of s9y would need to be made, which I currently think should not really be necessary.
Of course, one other possibility for you is to just subscribe to the RSS comment feed of your blog, as this will contain all comments made to the blog
But now for the simple plugin:
Code: Select all
<?php # $Id: serendipity_event_emoticate.php 1600 2007-01-26 10:01:30Z garvinhicking $
if (IN_serendipity !== true) {
die ("Don't hack!");
}
class serendipity_event_mailcc extends serendipity_event
{
var $title = 'Adds CC to all sent emails';
function introspect(&$propbag) {
global $serendipity;
$propbag->add('name', 'Adds CC to all sent emails');
$propbag->add('description', '(Notice: Make sure that the all of your authors have the option to receiv comment notification emails activated, or else no mails will be created that can be CCed');
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '1.0');
$propbag->add('requirements', array('serendipity' => '0.8','smarty' => '2.6.7','php' => '4.1.0'
));
$propbag->add('groups', array('BACKEND_FEATURES'));
$propbag->add('event_hooks', array('backend_sendmail' => true));
$propbag->add('configuration', array('cc'));
}
function generate_content(&$title) {
$title = $this->title;
}
function introspect_config_item($name, &$propbag) {
switch($name) {
case 'cc':
$propbag->add('type', 'string');
$propbag->add('name', 'E-Mail address to CC');
$propbag->add('description', '');
$propbag->add('default', 'nobody@example.com');
break;
}
return true;
}
function event_hook($event, &$bag, &$eventData) {
global $serendipity;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'backend_sendmail':
$eventData['headers'][] = 'CC: ' . $this->get_config('cc');
return true;
break;
default:
return false;
}
} else {
return false;
}
}
}
HTH,
Garvin
Thank you!!
Posted: Wed Feb 14, 2007 10:55 am
by Mickel
I just installed the plugin and it works WONDERS!! You're good!!
Thank you so much for taking the time to do this for me. I really appreciate it

. I have to try and get into the details of Smarty. It looks easy, but I am not as PHP literate.
Anyways, thanks again

Re: Thank you!!
Posted: Wed Feb 14, 2007 11:43 am
by garvinhicking
Hi!
Great to hear that it works, you'Re welcome.
Best regards,
Garvin
Re: All comments to central e-mail address
Posted: Wed Feb 14, 2007 1:06 pm
by stm999999999
garvinhicking wrote:
Just copy and paste the code below and save it inside /plugins/serendipity_event_mailcc/serendipity_event_mailcc.php.
Will it be put to spartacus?
Re: All comments to central e-mail address
Posted: Wed Feb 14, 2007 1:10 pm
by garvinhicking
Hi!
Will it be put to spartacus?
Nah, this is IMHO too small for too little benefit to let it clod up spartacus.
Best regards,
Garvin
Posted: Wed Feb 14, 2007 4:04 pm
by stm999999999
hm, 1st I think nothing is too little, our plugin-pool must grown up!
2nd: I believe that this plugin can be interesting for every non-single-user-blog because - as I wrote many time before - even emails with "please approve a comment" go to the article-author wo has not the privileges to approve. So, with this plugin, these emails can go to one admin-user, too.
Posted: Wed Feb 14, 2007 4:12 pm
by garvinhicking
Hi!
stm999999999 wrote:hm, 1st I think nothing is too little, our plugin-pool must grown up!
But not with the current Spartacus infrastructure. The large package.xml is already too large and fails on servers with only 8MB memory.
Best regards,
Garvin
Posted: Wed Feb 14, 2007 4:18 pm
by stm999999999
Uih, that's bad

Posted: Thu Feb 15, 2007 9:24 am
by garvinhicking
Hi!
Lars Strojny offered to do some work on improving spartacus and changing the API. Let's see what he/we can come up with.
Best regards,
Garvin
Posted: Wed Mar 07, 2007 6:42 pm
by cleanforum
Many thanks for the question and the answer - the former was broadly what I was seeking to do and Gavin's plugin-ette did it!
Thanks to you all.
Phil
Posted: Thu Mar 08, 2007 4:03 pm
by tchirou
Hi,
I have installed Garvin's Plugin and it gives this in the header of the administration panel and in the box indicating "your entry has been saved".
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /mnt/136/free.fr/e/c/akeow/serendipity/plugins/serendipity_event_mailcc/serendipity_event_mailcc.php:2) in /mnt/136/free.fr/e/c/akeow/serendipity/include/functions_config.inc.php on line 567
Warning: Cannot modify header information - headers already sent by (output started at /mnt/136/free.fr/e/c/akeow/serendipity/plugins/serendipity_event_mailcc/serendipity_event_mailcc.php:2) in /mnt/136/free.fr/e/c/akeow/serendipity/plugins/serendipity_event_httpauth/serendipity_event_httpauth.php on line 185
Warning: Cannot modify header information - headers already sent by (output started at /mnt/136/free.fr/e/c/akeow/serendipity/plugins/serendipity_event_mailcc/serendipity_event_mailcc.php:2) in /mnt/136/free.fr/e/c/akeow/serendipity/serendipity_admin.php on line 11
Any idea ? It could scare my authors

Posted: Thu Mar 08, 2007 4:21 pm
by garvinhicking
Hi!
You might have saved the file with a whitspace/newline before the first <?php or after the last ?>, remove that and the error will go away.
Regards,
Garvin
Posted: Thu Mar 08, 2007 5:54 pm
by tchirou
Exact. Well done Mister
