1

I want to show interface to admin on plugin deletion, having choices (radio buttons) with a question - "Please let us know why are you deleting the plugin?"

I know about register_uninstall_hook but I cannot use HTML code in it.

1 Answer 1

3

This isn't going to be possible, primarily because for anything in your code to execute it needs to be activated, but if you're deleting a plugin it has already been deactivated.

You can't ask on deactivation because there are a lot of cases were the plugin may be automatically deactivated, e.g. updates

Most of the scenarios where you would have those hooks such as register_uninstall_hook etc would not occur on an admin page but inside an iframe.

To be able to do this, you would need the following:

  • A second plugin to watch for the first plugins deactivation
  • Javascript to watch for the deletion/uninstall links being clicked

This will fail if:

  • The second plugin isn't installed ( people probably won't bother installing it if the only purpose is to provide you with feedback )
  • The first plugin is removed from the filesystem rather than the GUI
  • The second plugin is deactivated

Also consider what happens when the plugin is ran on a multisite and network activated/deactivated

My recommendation would be to not bother. Aside from the technical issues implementing it, it's bad user experience, and I can't see how it would do anything other than annoy your end users ( encouraging them to never install the plugin again )

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.