[wp-hackers] register_activation_hook() problem

Jennifer Hodgdon yahgrp at poplarware.com
Tue Jul 28 13:55:53 UTC 2009


Austin Matzko wrote:
> On Tue, Jul 28, 2009 at 4:30 AM, Adam Taylor<adamjctaylor at gmail.com> wrote:
>> Here's my code snippet:
>>
>>    global $thumbs;
>>
>>    function thumbs_install() {
>>        $thumbs = new ThumbsUp();
>>        $thumbs->installThumbsUp();
>>    }
> 
> You want the global declaration inside of your function block instead:

It is definitely true that you need the global declaration inside your 
function. But specifically for activation, you may need to also leave 
the global declaration outside the function block as well. I've run 
into problems with activation in WP, and needed to do things like this 
in the main body of the plugin:
   global $wpdb;
   global $mymodulevariable = 12234;
in order to get activation functions to work correctly.

     --Jennifer

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal, WordPress, and custom Web programming



More information about the wp-hackers mailing list