Opened 14 months ago
Last modified 11 months ago
#20241 new feature request
make it possible for plugins to activate other plugins
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | magnus.melin@…, kpayne@…, contact@… |
Description
When creating a plugin that depends on other plugins, i would like to enable those plugins during activation of the main plugin.
This is currently not possible, as updates to active_plugins done by the other plugins get overwritten.
Please apply the attached patch to fix this.
Attachments (3)
Change History (12)
- Cc kpayne@… added
- Type changed from defect (bug) to feature request
scribu has done a nice write up on dependency management in plugins
http://scribu.net/wordpress/plugin-dependencies
And he's written a plugin to handle dependency management, too
These changes could potentially break backwards compatibility.
Dependencies aside, this is doable without any patch. You can use the activated_plugin hook, which fires after the option is updated. For deactivation, you could simply choose a later hook (even something like 'shutdown' would work, as would option_active_plugins).
Child plugins would indeed be nice, but it doesn't need to be either or. I'd see this patch more as a code fix than an actual feature...
How would it break backwards compatibility?
It's not doable without a patch afaikt. activated_plugin is run for every plugin not just *this* plugin like i want, i tried that first but ran into problems with plugins getting included multiple times (causing errors) and other strange problems.
Re option_active_plugins - did you mean updating the active_plugins option manually? That won't let the registration hook for each plugin run.
- Type changed from feature request to defect (bug)
V3 fixes a problem with the patch wrt multisite.
Anything more i need to do?
comment:7
coffee2code — 12 months ago
- Type changed from defect (bug) to feature request
I do see it as a bug fix, as it's not said anywhere that it shouldn't work, and i see no reason it shouldn't. If for some reason the fix isn't wanted, it should at least be documented that you're not allowed to activate other plugins from the registration hook.
comment:9
stephenh1988 — 11 months ago
- Cc contact@… added

proposed fix