Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installed plugin on view details showing "install Now" instead "latest Version installed" #552

Open
Thiararapeter opened this issue Jan 8, 2024 · 5 comments

Comments

@Thiararapeter
Copy link

Hello, There is an issue with installed plugin. when i click open view detail and te plugin is installed, be button should be "latest verson installed" but am getting "install now button" mostly works but after plugin updates, yes the plugin is installed but on view details plugin have "install now"
attached will demonstrate what am trying to say.

image
image

@Thiararapeter
Copy link
Author

also when plugin not activated but installed shows "
image

@YahnisElsts
Copy link
Owner

Are you saying that the "View details" link shows up even when your plugin is inactive? That would be unusual since the update checker obviously cannot add the "View details" link when it's not running. Is there something else that's adding the link?

@krassomatiker
Copy link

Hello, same here. When i click open view detail and the plugin is installed, the button should be "Activ" not "Install now".
plugin

@YahnisElsts
Copy link
Owner

After some research, it looks like this happens when the plugin slug is different from the name of the plugin directory. As a test, I took a plugin hosted on worpdress.org - a plugin that doesn't use PUC - and renamed its directory from slug to foo-slug. The button text also changed from "Active" to "Install Now".

The WP core function that detects the plugin state is install_plugin_install_status() in /wp-admin/includes/plugin-install.php. It doesn't look like there's a way to filter its input or output. Theoretically, PUC could change the slug in the update API response before it gets to install_plugin_install_status(), but I suspect that might break something else. The slug is used in a bunch of other places and it would take a while to find all of them and carefully verify that using the directory name instead would be safe.

Since the same problem can happen with plugins not using PUC, perhaps it's not something to be fixed on this end? In most cases, if you pick a slug that matches the directory name, and the user doesn't rename the plugin for some reason, it should be fine.

@krassomatiker
Copy link

My mistake, you are right. It was the wrong slug. Thank you for the fast help and the great plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants