[wp-hackers] Plugin uninstall/deactivate in 2.7 vs 2.6

Will Anderson wp-hackers at itsananderson.com
Sun Nov 2 01:53:05 GMT 2008


On Sat, Nov 1, 2008 at 9:44 PM, DD32 <wordpress at dd32.id.au> wrote:

> On Sun, 02 Nov 2008 10:09:32 +1100, A Walker <photofantaisie at live.fr>
> wrote:
>
>  In case I haven't explained myself very well (probably not, lol) the idea
>> is to only register the deactivation hook if the plugin is installed on WP
>> 2.6 and below.
>>
>> I'm scratching my head on this, and if anyone can point out where I've
>> overlooked the obvious - please do! Thanks!  :-)
>>
>
> If i'm understanding correctly, You're trying to work out how to only
> register a deactivation hook for WP < 2.7? ie. to replace the uninstall
> functionality?
>
> If so i'd do this:
>
> if ( function_exists('register_uninstall_hook') )
>    register_uninstall_hook('myplugin_uninstall');
> else
>    register_deactivation_hook('myplugin_deactivate')


Would you really want to define deactivating a plugin as the same as
uninstalling it?
Seems to me there are situations where you would deactivate a plugin but not
want to totally remove all its settings (if you deactivate plugins before
upgrading WordPress for example).
Perhaps a better way to do this would be to insert an "uninstall" link much
like people have talked about inserting "configure" links in the plugin
management screen.

I don't know though, maybe I'm wrong on this :)


More information about the wp-hackers mailing list