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

Callback on required plugin activated #791

Open
SGr33n opened this issue Jun 26, 2020 · 3 comments
Open

Callback on required plugin activated #791

SGr33n opened this issue Jun 26, 2020 · 3 comments

Comments

@SGr33n
Copy link

SGr33n commented Jun 26, 2020

Hi,
I'm looking for a callback to call when the required plugin is activated. No mention about something like this on the configuration.
I'm just looking for a way to set a custom option for the activated plugin.
Does already exist an hook that allows to do something like this?

Thanks!

@jrfnl
Copy link
Contributor

jrfnl commented Jun 27, 2020

hi @SGr33n TGMPA does not offer any hooks for that but WP natively does offer a hook you can use activated_plugin.
Using that hook, you will need to check that the $plugin which was activated was one of your required plugins, but I believe it should be usable for what you intend to do.

See: https://developer.wordpress.org/reference/hooks/activated_plugin/

Does that help ?

@SGr33n
Copy link
Author

SGr33n commented Jun 30, 2020

Thanks @jrnl! not at all, that's because if the user already activated the required plugin before I activate the TGMPA plugin it doesn't do the call. I think that TGMPA already do this check, in order to display the warning... we just have to know if there is some sort of hook.

@jrfnl
Copy link
Contributor

jrfnl commented Jun 30, 2020

@SGr33n Ah! Sorry, your question was a little ambigious.

In that case - you can use the (again) WP native is_plugin_active() method to check this for your required plugins.

Also see: #484 #485, #638.

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

No branches or pull requests

2 participants