[wp-hackers] register_activation_hook() problem
Adam Taylor
adamjctaylor at gmail.com
Tue Jul 28 14:56:17 UTC 2009
On Tue, Jul 28, 2009 at 2:55 PM, Jennifer Hodgdon <yahgrp at poplarware.com>wrote:
> Austin Matzko wrote:
> 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
>
I've tried:
global $thumbs;
$thumbs = new ThumbsUp();
function thumbs_install() {
//$thumbs = new ThumbsUp();
$thumbs->installThumbsUp();
}
global $thumbs;
function thumbs_install() {
$thumbs = new ThumbsUp();
$thumbs->installThumbsUp();
}
And
function thumbs_install() {
global $thumbs;
$thumbs = new ThumbsUp();
$thumbs->installThumbsUp();
}
And they *all* produce the same error:
*Fatal error*: Cannot redeclare thumbs_install() (previously declared in
/dev/site/wp-content/plugins/thumbs-up/thumbs-up.php:163) in *
/dev/site/wp-content/plugins/thumbs-up/thumbs-up.php* on line *164*
Saying that it does still activate the plugin.
--
adamjctaylor at gmail.com
http://www.twitter.com/adamtaylor
More information about the wp-hackers
mailing list