I have been asking WordPress to add some sort of plugin dependency for quite some time now. This should be add to core.
]]>Hi,
Great plugin, im using this for a recipe plugin that requires Posts 2 Posts, I have had a look at other plugin activation libraries, but couldnt get them to work.
I was wondering if it would be easy to modify this plugin so it automatically provided a link to the required plugin? (or even better, automatically installed it from the WP repo?)
or maybe if there was a way i could insert the link into the comments at the top of my plugin file under ‘Depends’ and have that show up as a link in the ul of required plugins?
Hi, great plugin. I have been using it for a few months.
If I’m not mistaken, for the version 1.3, I think the version number in plugin-dependencies.php needs to be updated.
I see it still listed as 1.2.1.
Thanks.
I’ll cross post to GitHub.
]]>This may relate to the other question about network activation, but from what I can tell on multisite no dependency is every shown as being “satisfied.”
That is, in the plugin_action_links() function, the $active_plugins and $network_active_plugins arrays are mutually exclusive. An item will never be in both. If it’s not in $active_plugins the dependency is then tagged “unsatisfied.” If the dependency is not in $network_active_plugins then it’s marked as “unsatisfied_network.” I should also mention that you also need to array_flip() the $network_active_plugins before you array_intersect() with the dependencies.
I would be happy to commit a fix for this if you posted a Github repo. But it would also help to understand conceptually what “unsatisfied network” means. It seems like what you should be keeping track of us “satisfied network”, “satisfied”, and “unsatisfied.”
]]>I added code to the plugin to show dependencies on MU plugins. This might sound counter-intuitive, as MU plugins cannot be deactivated–and MU plugins are handled pretty differently than regular plugins. But, I added this to help administer their dependent plugins. In our case there are dozens of plugins dependent on one of several MU plugins. Now we can see at a glance which plugins depend on which MU plugins. Since we found this helpful I thought other might as well.
I don’t see this plugin’s code on Github. If you post a repository there I would be happy to fork and submit a pull request. Otherwise, let me know what your thoughts are about this feature.
]]>Is it possible to disable a plugin based on the theme? I use a theme switcher for mobile viewers and I’d like to disable a plugin only when that theme is being used. Thanks
]]>I have a network WordPress setup where Plugin Dependencies is activated network-wide. Now, there are two plugins, PluginA
and PluginB
. PluginB
depends on PluginA
, like so:
<?php
/**
* Plugin Name: PluginB
* Depends: PluginA
*/
The first issue I’m experiencing is being able to activate PluginB
network-wide, regardless of whether PluginA
is active or not.
But, most importantly, when PluginA
is activated network-wide, PluginB
cannot be activated locally, on a single site!
Any thoughts?
]]>Up-front, I’m a php newbie, so sorry if this seems dumb.
I downloaded the plugin dependency plugin and I’ve gone through all the documentation I can find, however, I’m not exactly sure how to set up everything.
For example, I am using the WP-reCAPTCHA plugin for registration, comments, and a contact form. I don’t like the html and css that the plugin inserts into my page and want to update it but don’t want it overwritten (obviously) when the plugin is updated.
Do I copy the plugin a create a 2nd plugin folder, say “WP-reCAPTCHA Child”? What is the name of the file I’d have in this new plugin folder? Would I add the folling to this file?
/*
Plugin Name: WP-reCAPTCHA Child
Depends: WP-reCAPTCHA
*/
I was looking at the “installed plugins” page in WP for new plugin dependency-fields like in the screenshots on the plugin page, but no such luck.
Any help in the right direction would help, thank you.
]]>When a dependency plugin is deactivated, plugins that require it are also deactivated.
Is there any way that those plugins can be disabled rather than deactivated? I guess it would involve preventing the plugin from actually loading. Keeping it with an activated status will help when upgrading plugins and when deactivating plugins by accident and not realising other plugins have been permanently deactivated.
It may not be possible, but it’s a thought.
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>Nice plugin, scribu!
I found a bug though. Let’s say I have a dependent plugin that looks like this:
/*
Plugin Name: Cool BuddyPress Plugin
Depends: BuddyPress
*/
If BuddyPress isn’t activated, I can still activate Cool BuddyPress Plugin by using the “Activate” option under the “Bulk Actions” dropdown menu.
A quick solution could involve hiding the checkbox for plugins that do not meet the criteria.
]]>I can’t figure out what the standards or requirements are for plugin naming in wordpress. It appears, from the examples I read, that this plugin relies on site administrators following strict file-naming conventions when installing plugins. For example, if a plugin were to declare a dependency on contact-form-7/wp-contact-form-7.php and the admin decides to check it out into wp-content/plugins/contact-form instead of wp-content/plugins/contact-form-7 , the first plugin is unable to be enabled. I even tried just listing `wp-contact-form-7.php’ as a dependency.
There should be a more reliable way of identifying plugins. I think that even extracting Name: Contact Form 7' from wp-contact-form-7.php would be much more reliable than depending on the filename. Unlike in drupal, as another user mentioned earlier, plugins in wordpress don't even have a standard location for a
computer-friendly’ name. The www.ads-software.com URI for wp-contact-form-7 is https://www.ads-software.com/extend/plugins/contact-form-7 — thus contact-form-7' would seem to be the longer-standing reliable handle for that plugin. Yet the
contact-form-7′ is not present in _any_ of the metadatada fields — not even in its readme.txt.
Perhaps we can come to a compromise that might work, though. Even though plugins are resilient to the point of them being placed in different folders… and often to having the plugin entry point .php file (wp-contact-form-7.php in this case) be renamed, there is no reason I can think of for the administrator to rename a plugin’s .php file — unless if he’s developing a different plugin, of course. So ignoring the directories in a plugin’s per-installation identifier yields a slightly stabler identifier — the basename of the plugin.
Could plugin-dependencies be modified to accept Depends: wp-contact-form-7.php' and recognize a match even when the per-installation identifier for Contact Form 7 is
contact-form-7/wp-contact-form-7.php’? May the documentation be updated to encourage plugin authors to use the `Provides:’ directive unconditionally in every plugin since the identifier a plugin author places in that directive will enable plugins to depend on it without worrying about this folder names problem?
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>Instead of disabling the conflicting plugins outright, can some variable or option be set, notifying the plugins of the conflict? That way, an author could disable the part(s) of his plugin that conflicted but let other parts continue working.
If there are, say, two Facebook plugins – one providing login and one providing syndication – they wouldn’t both try to add data to the header, and could potentially share other data.
Maybe an administrator could even select which of the conflicting plugins should provide the feature in question.
I love the idea of this plugin, and think it’s something that could really help keep people from reinventing the wheel so often in plugins.
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>When I deactivated a plugin which had a dependency I was allowed to do that and I was unable to re-active the plugin. The Active button was replaced with the Edit button (as in edit plugin in editor).
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>Great to see somebody tackle this! Drupal uses module dependencies to good effect, and I’ve always thought it would be a good idea for WordPress, too.
Suggestion: you currently deactivate the child plugin if a parent dependency is deactivated. In Drupal, they don’t let you deactivate a parent, until all of the dependent children are first deactivated. Could that be handled, and if so, what do you think about doing it that way? It seems a little more robust, to me.
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>One potentially useful feature for plugin dependencies would be to support conflicting plugins, e.g. plugin X can be enabled or plugin Y can be enabled, but not both. In the dependency sense, plugin X requires not plugin Y and vice versa.
A related concept could be applied to normal dependencies, where plugin X requires either plugin Y or plugin Z.
https://www.ads-software.com/extend/plugins/plugin-dependencies/
]]>