Administrator can enable module and set configuration. Banner displays for Administrator but is not visible to Anonymous users.

Comments

wildfeed created an issue. See original summary.

wildfeed’s picture

Title: Banner does not show for anonymous usea » Banner does not show for Anonymous User
sophie.sk’s picture

Category: Bug report » Task
Priority: Major » Normal
Parent issue: » #3082328: Allow restriction of messages to certain roles, users, entities

Hi, thanks for the report!

There is a new permission to display the banner to certain roles. Take a look at #3082328: Allow restriction of messages to certain roles, users, entities. Make sure that anonymous users have this permission assigned.

One thing I overlooked in that issue, though, was that the permission won't be assigned to users by default when the module is installed. I'll add a hook_install() to make sure that anonymous and authenticated users get the permission on module install.

sophie.sk’s picture

Oh wait, there IS an install hook. I need more coffee before I start replying to issues. :D

Hmm, can you confirm what your setup is? Did you run the update after upgrading to 1.1 or is this a fresh install?

jmcerda’s picture

I fixed the issue with the following patch.

Instead of using jQuery .once() i used .one()

Seems to have fixed the issue.

sophie.sk’s picture

Hmm, that shouldn't make any difference, but I'm glad it fixed it for you.

I suspect it could be the cache tags. The page attachments only cache based on the config. If it should show/not show based on user role as well, then that should probably be added - it may explain why you're not seeing it appear after assigning a permission, or after a JavaScript change (maybe flushing the caches after that).

sophie.sk’s picture

StatusFileSize
new790 bytes

I've added cache contexts to the message banner and also made sure the jQuery.once library is a dependency for the Message Banner library. Doh! Forgot that needs to be there, administrators obviously can see it.

  • Sophie.SK committed f3cf9e6 on 8.x-1.x
    Issue #3138382 by Sophie.SK, jmcerda: Banner does not show for Anonymous...
sophie.sk’s picture

Status: Active » Fixed

Fixed and pushed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.