Hello! This module sounds great and seems to cover the gaps I did not get to with User Alert.

One thing I did not see mentioned that I wanted to ask, does this module support the dismissing of messages for Anonymous users? Meaning can each Anonymous user see messages, dismiss them, and not affect it for other users?

CommentFileSizeAuthor
#5 dismiss_for_anonymous-1324964-5.patch2.27 KBxatoo

Comments

soyarma’s picture

I hadn't directly considered this use-case. Persistent messages are stored in the db, and referenced by UID. Unfortunately in D7 anonymous users aren't easily separated from one another--my thought had been that you'd just set messages for anonymous users to not persist.

Are you thinking that you would like a message for an anonymous user to persist across multiple page loads, but be unique for that user?

kevinquillen’s picture

Pretty much. Then you could have an entity / content type built around this, so there was a frontend to pdm_create_message.

An example of this would be here:

http://www.travelcoalition.org/

The 'Action Alert' is basically PDM, but the dismissing works for each anonymous user too (via cookie). But that requires UUID for anonymous users in their session to track in the cookie. If the user is logged in, it simply uses uid. Then again, I am using this in a way where a site admin can send out a message to all users and let them close it at will, not just when drupal_set_message is called for example.

But perhaps that is too much? I wouldn't mind closing User Alert in favor of this since it solves basically every other use case.

soyarma’s picture

I'll give this some thought. I do like the idea of creating alerts that would show for all users until dismissed--though that may start to chew up a lot of db space (because you need to store when they've been dismissed so they don't show again). However, once an alert made via the UI is removed from the site, we could remove all entries from the pdm table as well so that we don't clog things up with old data.

There is one caveat, because we'd use a cookie to determine if the user should still see the message or not, we would be serving non-cached pages to all users. If the message was non-dismissable then it wouldn't be an issue because all users could see the same message all the time and it would be OK, but if they were individually dismissable, and you put out a message to all users, then it would be the same as turning off all page caching on the whole site.

gcassie’s picture

xatoo’s picture

Title: Anonymous Users » Dismissable messages for anonymous Users
Category: support » feature
Status: Active » Needs review
StatusFileSize
new2.27 KB

Here is a patch that will check whether the user is logged in.
If not, hidden messages will be registered in the browsers local storage and re-hidden upon page load.

soyarma’s picture

Status: Needs review » Fixed

committed

soyarma’s picture

Status: Fixed » Closed (fixed)

Now in 7.x-1.1-beta1