Make WordPress Core

Opened 20 years ago

Closed 19 years ago

#1052 closed enhancement (wontfix)

Plugin Activation/Deactivation action

Reported by: jcumberland's profile jcumberland Owned by: skippy's profile skippy
Milestone: Priority: lowest
Severity: normal Version: 1.5
Component: Administration Keywords: bg|dev-feedback
Focuses: Cc:

Description

Add actions to plugins.php to call local activation and deactivation functions, allowing each plugin the ability to create and destroy the necessary environment for the plugin. Attached is a diff with the changes, only two lines. The idea came up when I needed to create a table to store values.

Attachments (1)

diff.txt (788 bytes) - added by jcumberland 19 years ago.

Download all attachments as: .zip

Change History (9)

#2 @jcumberland
20 years ago

  • Patch set to No

#3 @anonymousbugger
20 years ago

Whoops! I didn't take other plugins into account, my mistake.

#4 @ColdForged
20 years ago

Interesting concept, but of dubious merit. It would be counterintuitive to a user to deactivate a plugin and have the plugin delete all reference to itself everywhere such that the user would have to re-enter any configuration options.

On a plugin _delete_ I could certainly see some merit but even so, to my mind, it's nice for people to be able to be fluid in the plugins that they want to use and if they later want to try to use a plugin that they had been using before that the plugin will "remember" what it was that they did.

@jcumberland
19 years ago

#5 @skippy
19 years ago

  • Keywords bg|2nd-opinion added
  • Owner changed from anonymous to skippy
  • Priority changed from normal to lowest
  • Status changed from new to assigned

I agree with ColdForged that leaving plugin data lying around doesn't cause harm, and can be quite beneficial.

Are there any other instances where a hook for plugin activation or deactivation would be useful?

#6 @coldforged
19 years ago

My initial comment notwithstanding, I'd have to go with "more hooks == better". While I disagree with the intent of the original poster (destroy environment) you never know what people might have in mind for future ideas.

#7 @markjaquith
19 years ago

  • Keywords bg|dev-feedback added; bg|2nd-opinion removed

Yeah, there are certainly other uses for this hook. Maybe not deleting all the options (I'd leave them), but for coordination between plugins, for instance.

Passing on for dev feedback.

#8 @davidhouse
19 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

This is provided by register_activation_hook() and register_deactivation_hook().

http://trac.wordpress.org/changeset/2697

Note: See TracTickets for help on using tickets.