[wp-hackers] [help] sink plugin hooks for $this references in WordPress 2.0 ?

Niels Hackius niels.hackius at gmail.com
Fri Jan 13 20:17:12 GMT 2006


Dear Sir or Madam,

In the Codex it says:
***You can also sink plugin hooks to object instances. Here is an example of
how to do this using the class above:*

*$mailer = new emailer();
add_action('publish_post', array(&$mailer, 'send'));*

*Whenever a post's status is set to "Publish", WordPress will execute the
send() method of the $mailer object. Used this way, the class can make use
of $this-> references, whereas the static calling method above can only call
the class methods statically using the scope resolution operator.
*

I am doing this
$lbnh_installer_reference = new loadbalancer();

add_action('activate_samba/loadbalancer.php',array(&$lbnh_installer_reference,"installer"));


And I am also getting a confirmation that the constructor of the
loadbalancer class has been run, however it doesn't run the installer
function.
I am doing this, because I am wanting to use $this references within the
class.


Help would be nice or maybe this isn't possible in Wordpress 2.0 anymore?
I actually posted this in the wordpress.org support forums (@
http://wordpress.org/support/topic/56213) and David Chait suggested I should
ask on this list.

I appriecieate any help and/or pointers.

Kind regards,
niels hackius


More information about the wp-hackers mailing list