Meldingsbanners

Hey @gormus, I’m getting this error while trying to install:

An error occurred: Error creating upload asset: splide_css. Original filename Sorry, the file you are trying to upload is not authorized (authorized extensions: wasm, jpg, jpeg, png, woff, woff2, svg, eot, ttf, otf, gif, webp, avif, js).

Update: It worked, I actually forgot to add CSS in extensions.

3 likes

I add two banners to the same outlet and select carousel on both. But they only show stacked. Am I missing something for the carousel to work?

1 like

Hi @manuel there needs to be at least 2 banners in the same outlet for the carousel to work; and of course the Display in a Carousel option must be enabled on all banners too. The carousel won’t render if only one of the banners enabled.

Also;

  1. do you get any javascript errors in the browser console? Any of them reference to notification banners?
  2. condering there may be a conflict; were you able to isolate the issue to notification banners by disabling the other themes, components and plugins? or by using the safe mode?

Alternatively, would you mind sharing the settings? So, I can import and try it on my end…

  1. On the Discourse Notification Banners admin page, click on the Settings Editor` button at the bottom of the page.
  2. Copy the JSON data
  3. Strip any sensitive data you may have
  4. Share the JSON data in reply here, or DM me
2 likes

Thanks @gormus! I’m a bit lost why it didn’t work.. I set it up on two independent instances and didn’t work on both. Now I started again from scratch and works on both! :+1: :upside_down_face:

2 likes

Hoi, wat betreft het publiek, het lijkt onmogelijk om alleen TL0-gebruikers te targeten, toch? Want iedereen is TL0?

1 like

Ik ben bang dat je gelijk hebt @patrickemin De vertrouwensniveaus zijn additief en uiteindelijk maken ze alle ingelogde gebruikers standaard deel van TL0, ook al worden ze handmatig naar TL4 verhoogd.

Dus, als je momenteel TL0 selecteert als publiek, selecteer je in feite alle ingelogde gebruikers. Op zichzelf heeft dit waarde naar mijn mening, maar dit kan misleidend zijn.

Ik denk dat ik de logica voor het publieksveld ga updaten en een nieuwe regel ga definiëren voor alle vertrouwensniveaus. Bedankt voor het idee : )

2 likes

Hallo @gormus Ik heb je notities hier gevolgd voor je reactie op nolo, maar om een of andere reden krijg ik de meldingen niet als carrousel te draaien. Ze blijven gewoon gestapelde berichten. Ik heb twee testberichten en carrousel is ingeschakeld voor beide en ze staan in dezelfde outlet. Niets in de console voor fouten met betrekking tot js. en ik heb alle andere componenten uitgeschakeld en niets lijkt te werken. Ideeën?

Hoi @marksalter, klinkt alsof je de gebruikelijke verdachten al hebt gecontroleerd. Het enige andere dat ik kan bedenken, is proberen het probleem te reproduceren met je instellingsexport. Stuur me een DM met je exportbestand, ontdoe het van gevoelige gegevens indien nodig. Ik ben echter pas over 10 dagen terug : )

Hallo, ik heb deze foutmelding bij het bijwerken van mijn bannersbericht:

De JSON-pointereigenschap “/0/enabled_groups” moet een array zijn van geldige groeps-ID’s.

By any chance you have a reference to a deleted (or renamed) user group in the Audience field?

1 like

Bedankt, dat was het. Ik ging ervan uit dat groepen alleen werden geïdentificeerd op hun ID en dat de naam er niet toe deed.

1 like

I’ve been considering this idea to better target an audience using the Trust Levels:

I think I have something for you all to check out.

Though, I recommend testing this on a non-production environment first as it introduces a breaking change.

To install this version, use the staging branch of Notification Banners:

Breaking change

When the banner visibility is evaluated using the Audience field values, all the trust_level_* roles of the visitor are ignored, except the highest level.

For example, consider a user has these roles: support_team, blog, trust_level_0, trust_level_1, and trust_level_2.

The Audience field will consider the user only has support_team, blog, and trust_level_2.

So, if a banner needs to target only the TL2 users, the Audience field should need to be set to trust_level_2. The other trust levels will not see the banner.

I updated the description for the Audience field to clarify this change as well.

I plan to test these changes further, and probably create a new release by end of September. I appreciate any feedback you may provide.

Thanks!

2 likes

v1.3.0 is released now.

Make sure to test it before deploying to production.

Notable changes:

  • Banners are now sorted as they are displayed on the settings page. Instead of the “Display order” field, now you can sort the banners using the native re-ordering buttons.

  • Changed the behavior of the Audience field:

    Select which user groups can see this banner. You must select at least one group.

    To show to all users and visitors: Select the everyone group.

    Important note on Trust Levels: Selecting a Trust Level (e.g., trust_level_3) will show the banner only to users at that exact level. It does not include users at higher or lower levels.

  • Changed default Splide carousel options:
    before:

    { "arrows": false, "autoHeight": true, "autoplay": true, "direction": "ttb", "focus": "center", "height": "15vh", "gap": 0, "type": "loop" }
    

    after:

    { "autoHeight": true, "height": "8rem", "arrows": false, "autoplay": true, "direction": "ttb", "focus": "center", "gap": 0, "type": "loop" }
    
2 likes

Hi, the lastest update broke my site (only the site header is loaded), had to deactivate the TC and everything is back to normal. Let’s see if it’s only me, no hurry :grinning_face_with_smiling_eyes:

1 like

Thanks for the report @patrickemin , and the details you provided.

The hotfix (v1.3.1) I deployed earlier should have fixed the problem I introduced in v1.3.0. My apologies to everyone who had to experience the issue.

I’m trying to get this component working. But the test banner I created does not show. I am using a very up to date Discourse version (about 3 days old) and 1.3.1 of the component.

I’m pretty sure the options are set okay. I also tried all three locations for the test banner to show. Nothing.

Is there another bug oder is this a user problem? Where could I look?

Do you happen to see any errors logged in the console?

If the console is free of errors, perhaps you could DM your config using Settings Editor?
Pls sanitize the message strings from any sensitive details you may have.

Only deprecation notices. Plus (but only in Opera, not Firefox, and I have set Content security policy script src to 'unsafe-eval' for a long time):

Content Security Policy of your site blocks the use of ‘eval’ in JavaScript`

The Content Security Policy (CSP) prevents the evaluation of arbitrary strings as JavaScript to make it more difficult for an attacker to inject unathorized code on your site.

To solve this issue, avoid using eval(), new Function(), setTimeout([string], ...) and setInterval([string], ...) for evaluating strings.

If you absolutely must: you can enable string evaluation by adding unsafe-eval as an allowed source in a script-src directive.

Thank you. I can also post this here, as I only have one test banner active at the moment:

[
	{
		"setting": "banners",
		"value": [
			{
				"title": "Testbanner Titel",
				"message": "Testbanner Text Testbanner Text",
				"date_after": "2025-11-01 12:00:00Z",
				"date_before": "2025-12-01 12:00:00Z",
				"dismissable": true,
				"plugin_outlet": "top-notices",
				"enabled_groups": [
					1
				]
			}
		]
	},
	{
		"setting": "splide_options__above_site_header",
		"value": "{ \"autoHeight\": true, \"height\": \"8rem\", \"arrows\": false, \"autoplay\": true, \"direction\": \"ttb\", \"focus\": \"center\", \"gap\": 0, \"type\": \"loop\" }"
	},
	{
		"setting": "splide_options__below_site_header",
		"value": "{ \"autoHeight\": true, \"height\": \"8rem\", \"arrows\": false, \"autoplay\": true, \"direction\": \"ttb\", \"focus\": \"center\", \"gap\": 0, \"type\": \"loop\" }"
	},
	{
		"setting": "splide_options__top_notices",
		"value": "{ \"autoHeight\": true, \"height\": \"8rem\", \"arrows\": false, \"autoplay\": true, \"direction\": \"ttb\", \"focus\": \"center\", \"gap\": 0, \"type\": \"loop\" }"
	}
]

I also tried without start and end dates and the other two plugin outlets. Also I have tried everyone instead of Administrators (this must be group 1 here in the setttings) to see an effect in Firefox without logging into the site. And I did not doctor with the splide options.

1 like

Thanks for the report @Roi .

Your configuration didn’t include a selection for any categories, and NB was erroneously denying access to the banner.

I just pushed a fix and released v1.3.2. Please update notification banners.

1 like

Yeah great it works now!

And yes, I left the categories selection empty as I thought, it is then displayed everywhere. So it was a bug in the component that it wanted an option for that? Anyway, it’s fixed now. Thank you! :slight_smile:

As I am new to this component may I ask some questions?

I want to notify/remind our users about getting involved in community. The idea was to bring up a banner every like 4 to 8 weeks to remind the users again and again. As soon as it is dismissed by a user, it is not visible anymore. So far, so good.

Can I just alter the start and end date and after saving it, the banner is displayed again for the users who dismissed it? (How does this work anyway? Cookies is my guess?) Or would I need to create a completely new banner?

Someone brought up a cycle here in the topic before. So display a banner every 8 weeks. That would be a great option, as it is completely maintenance-free - if you do not want to change other things. But the question remains if the banner shows up again for the users who dismissed it when the new cycle starts?