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

Unique id on dismissable notices buggy #353

Open
jrfnl opened this issue Apr 26, 2015 · 3 comments
Open

Unique id on dismissable notices buggy #353

jrfnl opened this issue Apr 26, 2015 · 3 comments

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Apr 26, 2015

Commit d868114 introduced a configurable id which is used to hash the dismiss-notices so they could re-appear, solving #174.

This will however only work if TGMPA would only be used by themes.

Example of situation in which it will work:

Theme A sets id 'theme-a'
Theme B sets id 'theme-b'

Theme A is active and user dismisses the notice.
The user then switches to Theme B and the (new) notice about theme B gets correctly shown.
User switches back to Theme A and the original notice for theme A has correctly been reset (on switch_theme) and shown again.

Example of situations in which it will not work :

Any situation where TGMPA is included in more than one theme/plugin which are loaded at the same time.
As Plugin B will override the id set by plugin A and the theme (being loaded after the plugins) will override the id again.

Secondly, if TGMPA is included with a plugin, the dismiss notice is not reset on deactivation of that plugin, in other words, the notice would not be shown again on re-activation of the plugin.

Similarly, if the notice has been dismissed and a required plugin has been deactivated or deleted, the notice will not be shown again.

@jrfnl
Copy link
Contributor Author

jrfnl commented Apr 26, 2015

Related issue #266

@ollietreend
Copy link

Is there any work being done on this issue yet? Perhaps it would be good to split these out into actionable changes, that can be discussed and agreed upon.

I'm currently being affected by this issue, and I definitely think it's worth addressing. I'll be happy to help where I can.

@BackuPs
Copy link

BackuPs commented Mar 17, 2018

I just delete the tgma notice in the user meta after a version update... So it re-appears on every new theme version. No need to switch themes and back to the original one again. Just a check in the theme code where i compare the current version of the theme against the version of the theme stored in the database. If they are different just drop the use meta and update the theme version.

f.e.

function after_theme_update(){

if(version_compare(THEME_VERSION, get_option(THEME_SLUG.'_version'), '!=')){

  delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.THEME_SLUG, null, true );
  update_option(THEME_SLUG.'_version', THEME_VERSION);

}

}

Note my tgma config is using the theme_slug as the ID !! THEME_SLUG is a define

config_tgma

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

3 participants