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

Resetting dismiss message status to false #174

Closed
qwertydude opened this issue Mar 20, 2014 · 2 comments
Closed

Resetting dismiss message status to false #174

qwertydude opened this issue Mar 20, 2014 · 2 comments
Assignees

Comments

@qwertydude
Copy link

I am using TGM in a plugin, and I noticed once I dismiss the message, it's gone forever. I wold like to provide a way for the user to re-enable it. Probably via a plugin action link. For that, I need method.

So, I looked in the code, found update_dismiss(). But if I read that correctly, it will reset for every installed theme or plugin that is also using TGM. That might not be so popular if I do that!

So, how do I tell it to just reset for my plugin? Does the user meta also track individually for each theme and plugin? Or would I have to manually mange that using a different variable instead of tgmpa_dismissed_notice.

If not, would it be possible to add to the global configuration options one to override that name with our own?

Further, when I call

TGM_Plugin_Activation::update_dismiss();

I get a Strict notice about calling non-static methods statically, so am having to duplicate the code in that method, which I'd rather not do - even though it is only one line. (I find some client PHP installs are have Strict notices enabled, so I need make sure my plugins don't generate any)

Thanks

BTW This is the most useful add on ever!

@thomasgriffin
Copy link
Contributor

Ahh, thanks for catching that! I should probably add a new parameter called "id" that will allow you to add a unique ID, and I can use that for the setting so that multiple notifications are not closed when one notice is dismissed.

As for the strict notice, you are not calling it correctly. You need to call it like this:

TGM_Plugin_Activation::get_instance()->update_dismiss();

The get_instance() holds the object instance, and from there you can reference methods within that object.

@qwertydude
Copy link
Author

Sweet, thanks, Thomas. Will do that.

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