שלטי הודעות

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 לייקים

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

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 לייקים

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 לייקים

שלום, לגבי הקהל, נראה שאי אפשר למקד רק משתמשי TL0, נכון? כי כולם TL0?

לייק 1

אני חושש שאתה צודק @patrickemin רמות האמון מצטברות ובסופו של דבר הופכות את כל המשתמשים המחוברים לחלק מ-TL0 כברירת מחדל, למרות שאם הם מקודמים ידנית ל-TL4.\n\nלכן, כרגע אם תבחר TL0 כקהל, בעצם אתה בוחר את כל המשתמשים המחוברים. כשלעצמו יש לזה ערך לדעתי, אבל זה יכול להטעות.\n\nאני חושב שאעדכן את הלוגיקה עבור שדה הקהל, ואגדיר כלל חדש לכל רמות האמון. תודה שנתת לי את הרעיון : )

2 לייקים

שלום @gormus עקבתי אחר ההערות שלך כאן לתגובתך ל-nolo אך מסיבה כלשהי איני מצליח לגרום להתראות לפעול כקרוסלה. הן פשוט יושבות כהודעות מוערמות. יש לי שתי הודעות בדיקה והקרוסלה מופעלת עבור שתיהן והן יושבות באותו שקע. שום דבר בקונסול עבור שגיאות הקשורות ל-js. וכיביתי את כל הרכיבים האחרים ושום דבר לא נראה שעובד. רעיונות?

Hi @marksalter , sounds like you already checked out the usual suspects. Only other thing I can think of is trying to reproduce the issue using your setting exports. Pls DM your export file, sanitize the data if necessary. However I won’t be back for another 10 days : )

היי, יש לי את השגיאה הזו בעת עדכון הודעת הבאנרים שלי:

מצביע ה-JSON “/0/enabled_groups” חייב להיות מערך של מזהי קבוצות חוקיים.

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

לייק 1

תודה, זה היה זה. הנחתי שקבוצות מזוהות רק לפי ה-ID שלהן והשם לא משנה.

לייק 1

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 לייקים

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 לייקים

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

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

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

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?