• Resolved Karl Silver

    (@karlfox2014akakldkarl)


    Hello, wpexplorer team.

    Thanks for the great plugin.

    Is there a way to invalidate the local storage key:value pair “easy_notification_bar_is_hidden:yes” as soon as the site owner updates the notification message?

    The use case is something like this:
    A site owner publishes a message about a shop discount.
    User X clicks the close-button after seeing the message, it disappears.
    A site editor adds a different message two weeks later.
    User X returns and never sees the new message.

    I am thinking of something like “enb_[date-of-last-change]_hidden:yes”. But maybe there is an easier way.

    Sorry, I didn’t find anything about this in the forum. If the functionality above is not the point of this plugin please let me know. I guess I am looking for something like an “Alert banner plugin” that always overrides old local storage values.

    Thanks again for the great plugin.

    Best regards,

    Karl

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author wpexplorer

    (@wpexplorer)

    Hi Karl,

    This is AJ the plugin author.

    Sorry for the super late reply, I never got the email from WordPress regarding this comment and happened to see it when I got an email for a newer comment.

    I actually thought about doing this but figured most people that are closing the notification are usually not going to be interested in any notification anyway, they want to just come back and not be bothered by anything at the top of the site.

    That said, I do see how people will want to be able to display new notices to their readers without worrying if it had previously been closed. Your idea of adding a timestamp could be a good solution. Except in a situation where you have someone that is making many tweaks to the notification bar (maybe due to client requests) and only barely changing things (not actually setting a completely different notice).

    Also, making the change in this manner will reset the notice for everyone updating the plugin, which is a concern.

    I definitely want to add this functionality but need to think of the best way. Maybe the best way would be to have a setting to choose between Local Storage and Cookie Session. This way if you use the latter, I can use a session cookie instead of local storage this way if the user closes the notice it will remain hidden only during the current session and deleted when they close their browser. I do believe that is more “normal” then storing new cookies every time a change is made.

    Would love to hear your thoughts if you have any followups, thanks!

    – AJ

    Plugin Author wpexplorer

    (@wpexplorer)

    Oh, I had another thought…I could add a new field named something like “Local Storage Keyname” this way you can define the keyName to be used this way anytime you want it reset you can just save a new value and it can just relate to whatever the current message is.

    @wpexplorer Maybe obfuscate the keyname and just have a button that re-randomizes it? Then the wording is much more non-technical-user-friendly: “Click to refresh notification bar for users who have dismissed it.” or something.

    Plugin Author wpexplorer

    (@wpexplorer)

    @eclev91 – yep, that’s a much better idea ?? Added to my todo list!

    @wpexplorer Any update regarding this feature? Cheers!

    Plugin Author wpexplorer

    (@wpexplorer)

    Hi,

    I started working on this and will try and push out the update today or within the next couple days. I was thinking of actually just saving a standard “hidden” option with the current notification bar text and then just checking on customizer_save whether the current text is the same as the one being saved and if not save a newhidden option with the current timestamp to append to the localStorage keyName, this way it’s automatic.

    Hope you are having a nice holiday season ??

    – AJ

    @wpexplorer Thank you for your update on this matter. That’s great news!

    Have a fantastic New Year’s Eve ahead. And Happy New Year! ??

    Plugin Author wpexplorer

    (@wpexplorer)

    @apollosk – Just finished coding this and will push out the official update shortly. Here is a quick video showing how it’s working if interested – https://a.cl.ly/L1uW4QL7

    And this is the code I ended up using (easy!) – https://a.cl.ly/9ZuDP0vz – so I save a global variable with the current message on the customize_save hook and then I check it against the message setting on the customize_save_after hook to see if they are the same and if not I update the timestamp.

    Then I simply pass the timestamp over to the javascript.

    Let me know if you see any potential issues with this method, thanks!

    – AJ

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show again with new Message?’ is closed to new replies.