[wp-hackers] [help] sink plugin hooks for $this

Jamie Talbot wphackers at jamietalbot.com
Sat Jan 14 10:34:13 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David House wrote:
> On 13/01/06, Niels Hackius <niels.hackius at gmail.com> wrote:
> 
>>this way however it doesn't:
>>$test = new loadbalancer();
>>add_action('activate_samba/loadbalancer.php', array(&$test, 'installer'));
> 
> 
> If $test is a global variable that should work.

If you're still having problems you could try adding the action using just a call to
LoadBalancerClass::installer like this:

add_action('activate_samba/loadbalancer.php', array('LoadBalancerClass', 'installer'));

installer() {
	global $test;
	// Install Here
}

It's a hack, not particularly pretty and of course you have to declare $test global because you can't use $this
inside the 'installer' function, but it might work for you.

Cheers,

Jamie.

- --
http://jamietalbot.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDyNOlrovxfShShFARArZnAJ924Ux3dAY6w6Bpjbeyv7hyHOlFWwCfRdAe
arCV7DRj0JBA09cb8r7ex/E=
=W9lj
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list