Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Roundcube Community Forum
»
Third Party Contributions
»
API Based Plugins
»
Error: Call to a member function register_hook() on a non-object
« previous
next »
Print
Pages: [
1
]
Author
Topic: Error: Call to a member function register_hook() on a non-object (Read 4569 times)
snugge
Newbie
Posts: 2
Error: Call to a member function register_hook() on a non-object
«
on:
March 21, 2013, 10:45:01 PM »
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?
Logged
SKaero
Administrator
Hero Member
Posts: 5,900
Re: Error: Call to a member function register_hook() on a non-object
«
Reply #1 on:
March 22, 2013, 01:11:48 AM »
I believe this is the bug thats causing the problem:
http://trac.roundcube.net/ticket/1488941
Its fixed in the git master.
Logged
SK
aero
alec
Hero Member
Posts: 1,366
Re: Error: Call to a member function register_hook() on a non-object
«
Reply #2 on:
March 22, 2013, 04:53:32 AM »
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.
Logged
snugge
Newbie
Posts: 2
Re: Error: Call to a member function register_hook() on a non-object
«
Reply #3 on:
March 22, 2013, 08:25:31 AM »
Thanks alec, the method name was the problem.
(oh god how I loathe OO)
Logged
Print
Pages: [
1
]
« previous
next »
Roundcube Community Forum
»
Third Party Contributions
»
API Based Plugins
»
Error: Call to a member function register_hook() on a non-object