[wp-hackers] register_activation_hook() problem

Adam Taylor adamjctaylor at gmail.com
Tue Jul 28 09:30:15 UTC 2009


Hi,

So I'm writing my first plugin and I've come across a problem, I'm hoping
it's very straightforward, I'm unfortunately not a php expert:

Here's my code snippet:

    global $thumbs;

    function thumbs_install() {
        $thumbs = new ThumbsUp();
        $thumbs->installThumbsUp();
    }

   register_activation_hook(__FILE__,'thumbs_install');

I found this discussion:
http://www.nabble.com/Odd-behaviour-when-using-classes-and-the-register_activation_hook()-function-td20826067.html<http://www.nabble.com/Odd-behaviour-when-using-classes-and-the-register_activation_hook%28%29-function-td20826067.html>and
I think it may be to do with my [mis]use of global variables in PHP -
not sure I've got my head around them properly.

Any pointers?

Thanks

-- 
adamjctaylor at gmail.com
http://www.twitter.com/adamtaylor


More information about the wp-hackers mailing list