[wp-trac] [WordPress Trac] #41767: plugin uninstall improvement
WordPress Trac
noreply at wordpress.org
Thu Aug 31 11:47:08 UTC 2017
#41767: plugin uninstall improvement
-----------------------------+-----------------------------
Reporter: petersplugins | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Keywords:
Focuses: administration |
-----------------------------+-----------------------------
Cleaning up data on plugin uninstall can be done via
register_uninstall_hook() or uninstall.php. But at this point it is not
possible to communicate with the user. So it is not possible to ask if
data created by the plugin should be deleted or kept for later.
Many developers solve this by adding an option to the settings page of
their plugin. This is not really user-friendly. Enabling the user to
choose whether data should be deleted or kept on uninstall would be much
better.
To achieve this the simplest solution in my opinion would be to add a new
line to the Plugin Header. Something like e.g.
{{{
Creates Data: No/Yes
}}}
If set to YES the "Delete" link on the Plugin Page should be replaced with
two links - "Delete Plugin & Keep Data" and "Delete Plugin And Data" or
similar. Only if the user clicks on "Delete Plugin And Data" the uninstall
hook should fire resp. the uninstall.php should be executed. So there
would be no need to change the code.
If set to NO it would be possible to somehow inform that the plugin does
not create any extra data. So the user knows that there will be no garbage
after uninstall.
If the line is missing inside the Plugin Header the plugin uninstall
should work as before.
This solution would be a huge improvement with little effort, I think.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41767>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list