[wp-hackers] A Question On Plugins

Andy Staines andy at yellowswordfish.com
Tue Apr 25 14:43:44 GMT 2006


Thanks Jamie. I am doing that bit OK. The weird thing is that I have  
quite a few users of this plugin - all successful - but just two have  
reported this problem.
They are the sort of bugs you just hate!
andy

On 02:34  PM |  Tue 25 Apr 06, at 02:34  PM |  25 Apr 06, Jamie  
Talbot wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andy Staines wrote:
>> One of my plugins requires two tables to be created. I coded this  
>> up as
>> a process in the 'activate' plugin hook. But for at least two people
>> (and maybe more) when they have activated the plugin, the tables have
>> not been set up. They are administrators of their blogs.
>>
>> Is this the 'right' way to ensure tables get created or is there a
>> better hook to use? And, if so, any ideas why it should fail?
>
> One thing to remember is that the activate hook is dependent on the  
> plugin name.  At first, I was
> confused because I'd installed the plugin to its own directory, but  
> not included that in the plugin
> hook.  As in using:
>
> add_action('activate_pluginname.php', array(&$this, 'activated'));
>
> instead of:
>
> add_action('activate_pluginname/pluginname.php', array(&$this,  
> 'activated'));
>
> Where the plugin files were in the directory 'wp-content/plugins/ 
> pluginname/'.  Other than them
> installing to the wrong directory, no idea why it might be  
> failing.  In any case, I decided to add
> my tables on the first view of an options page, then used the  
> activate hook to redirect the user
> straight to that page when the plugin was first installed, instead  
> of going back to the plugins
> page.  That way, even if the activation screws up, my tables will  
> still be created when they look at
> the config page.
>
> Cheers,
>
> Jamie.
>
> - --
> http://jamietalbot.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFETiVJrovxfShShFARAkyBAJ9lQ8ipxBQHIDrZozETx8GXOJQMHgCeNtfG
> hL0s97J+lBzz3z/fiWdsq64=
> =m6yF
> -----END PGP SIGNATURE-----
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list