[wp-hackers] Plugin uninstall/deactivate in 2.7 vs 2.6
Jacob Santos
wordpress at santosj.name
Sun Nov 2 06:53:23 GMT 2008
Will,
That is certainly a possibility. The right or wrong way isn't defined by
WordPress core, nor by anyone else. You may do what you want when you
write plugins. To go about saying that you must do it this way or that
way is not the intention of the community. Even more so, since you have
TWO methods of uninstalling your plugin. Once WordPress 2.7 is released,
even if one method is used more than the other, the second method will
still be supported nor removed. The whole argument that you shouldn't
uninstall a plugin at deactivation is what bought about uninstalling at
removal. I agree that deactivation shouldn't mean uninstall, because it
is recommended that users deactivate before upgrading. Many users will
be upset if you removed the settings on deactivation.
The argument that you should include a link, well several of the early
drafts of the patch did just that, in several different ways. It was
decided that since the majority of users will not want to just uninstall
a plugin (which is basically restoring the defaults or clearing or
cleaning of the plugin), unless they are completely removing it. You are
right that you can add your own link for uninstall, but a better name
would probably be "Restore defaults" instead.
Jacob Santos
Will Anderson wrote:
> 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 :)
> _______________________________________________
> 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