You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: I have two plugins using the ExamplePluginUpdater class: "Plugin A" and "Plugin B".
In the WP plugin list page I click "View version 1.2.3 details" for Plugin A to view details about that plugin. Then the filter in ExamplePluginUpdater fetches info for that plugin and correctly returns an object (non-false value). However since the filter is also used for Plugin B it's called again and since it's not the correct plugin slug this time, it returns false and the result from Plugin A is discarded and the result for the user is "Plugin not found.".
I solved this by using return $result; instead of return false; in the info function and it works for me after that change.
The text was updated successfully, but these errors were encountered:
I think there is a bug in the the class
ExamplePluginUpdater
and usage of theplugins_api
filter.The
info()
functionhttps://github.com/Make-Lemonade/lemonsqueezy-wp-updater-example/blob/main/includes/class-plugin-updater.php#L125-L146
returns
false
if the$action
is of the wrong type, or if the plugin slug is not the wanted one, or if the remote request fails. I believe it should return the passed$result
instead, because theplugins_api
filter can be used multiple times, for example using theExamplePluginUpdater
multiple times for multiple plugins (that was my case).Example: I have two plugins using the
ExamplePluginUpdater
class: "Plugin A" and "Plugin B".In the WP plugin list page I click "View version 1.2.3 details" for Plugin A to view details about that plugin. Then the filter in ExamplePluginUpdater fetches info for that plugin and correctly returns an object (non-false value). However since the filter is also used for Plugin B it's called again and since it's not the correct plugin slug this time, it returns false and the result from Plugin A is discarded and the result for the user is "Plugin not found.".
I solved this by using
return $result;
instead ofreturn false;
in the info function and it works for me after that change.The text was updated successfully, but these errors were encountered: