[wp-hackers] Activate Action not Working?

DD32 wordpress at dd32.id.au
Fri Apr 27 08:05:12 GMT 2007


remember its being passed as a string, not a reference.  
"self::init_database" will be to call the function init_database within  
the class that the plugin is activated in, "self" will no longer refer to  
the object it did when you added the action.
I think the syntax you'll want is:
add_action('activate_DonationTracker.php',  
array('DonationTracker','init_database') );

On Fri, 27 Apr 2007 17:54:01 +1000, Computer Guru  
<computerguru at neosmart.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm in the latest trunk, and I can't seem to get add_action(activate_*)
> to work properly....
>
> /////////////////////////////////////////////
> class DonationTracker() {
> 	function DonationTracke() {
> 		add_action("activate_DonationTracker.php", "self::init_database");
> //Tried lowercase too
> 	}
> 	function init_database(){
> 		...
> 	}
> }
>
> $DonationTracker =& new DonationTracker();
> /////////////////////////////////////////////
>
> Calling
> self::init_database();
>
> by itself in the constructor works just fine.
> I tried changing the action to activate_donationtracker.php and also
> tried changing the function from self::init_database to
> DonationTracker::init_database and this->init_database() to no avail.
>
> Any clues?
>
> - --
> Computer Guru
> NeoSmart Technologies
> http://neosmart.net/blog/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFGMawY3SICh4XKUt0RAvE8AJ9r5OA5opGIcx5njYbraVi9hEVZGwCfddhB
> TPbDS4XLTRbZUyVFLzmmUDA=
> =HgY/
> -----END PGP SIGNATURE-----
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the wp-hackers mailing list