Hi,
I'm trying to write a simple plug-in for logging sent mail, and i'm not even getting it to register its hooks...
code:
(plugins/log_sent_mail/log_sent_mail.php)
<?php
class log_sent_mail extends rcube_plugin
{
public $task = 'mail';
public $noajax = true;
public $noframe = true;
function init() {
$this->add_hook('message_sent', array($this, 'log_sent_mail'));
}
function log_sent_mail($arg) {
write_log('debug','sent mail');
}
}
?>
I just get this error:
PHP Fatal error: Call to a member function register_hook() on a non-object in /var/www/roundcubemail-0.9-rc/program/lib/Roundcube/rcube_plugin.php on line 130
are the docs at http://trac.roundcube.net/wiki/Doc_Plugins correct?
I believe this is the bug thats causing the problem: http://trac.roundcube.net/ticket/1488941 Its fixed in the git master.
Quote from: snugge on March 21, 2013, 10:45:01 PM
class log_sent_mail extends rcube_plugin
{
function log_sent_mail($arg) {
You have a method with the same name as the class name. They can't be the same.
Thanks alec, the method name was the problem.
(oh god how I loathe OO)