Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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 )

share|improve this answer
    
Okay, thanks for the answer. –  Rajat Varlani May 18 at 9:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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