Closed JasonTheAdams closed 2 years ago
Version checking for what? PHP or WordPress?
PHP version would be checked if GiveWP has the Requires PHP
header set. At best, this will be in WordPress 6.1. You can also set Requires WP
header in the plugin.
You won't be able to specify a version. You will be able to see a View Details iframe that should have that information. The most current version of GiveWP will be installed.
I believe the order in the Dependencies tab is alphabetical by slug, but not certain at the moment.
You could probably modify the order, etc via the plugins_api_result
filter.
I'm referring to the version of the dependency. In our case, for example, we might release GiveWP Recurring 2.0.0 which is dependent on GiveWP 3.0.0.
Now, I understand that actually checking the dependency version is not in the scope of this feature plugin. So what I'm talking about is doing something that's purely visual. So consider the following:
In this case, it would be useful to have a filter for the "Required by:" list on a per plugin basis. In our case, for example, we'd change "GiveWP" to "GiveWP 3.0.0" within that list. (Again, understanding that it's purely visual.) So the hook might look something like this in a highly simplified example:
add_filter('wp_plugin_dependency_list_item', function($plugin_name, $plugin_slug) {
if ( $plugin_slug === 'give-recurring' ) {
return $plugin_name . ' ' . GIVE_RECURRING_MIN_GIVE_VERSION;
}
return $plugin_name;
});
From here, our plugin would handle the actual version check. Does that make sense?
I could probably add a filter for that somewhere.
I added the filter but there's a problem. Using anything other that the true name doesn't all the proper creation of the View details link in the Requires: GiveWP
area.
Sorry, it just wouldn't be an easy fix.
You might try adding a plugin header with the needed data and then add some code to read and check it before allowing activation.
The idea was intended to be purely helpful to users. It's not a big deal, just a shame we can't surface such information to the user in light of this effort.
Honestly the scope is to encourage users to use the currently released versions of plugins. The feature is not designed to imitate composer's ability to specify versions.
I simple thought occurred to me as reflecting on how we'd use this in GiveWP. We currently, and will continue to, do version checking when someone installs one of our add-ons — we need to make sure it's compatible with the version of core installed.
I understand that versioning is out of the scope of this, which is fine. What would be useful would be to have the ability to filter the plugin names as they appear in the dependency lists. Even if it's not functionally doing anything, being able to have the dependency appear as "GiveWP 2.21.4" instead of just "GiveWP" — as a subtle communication to the user.