Conditional filters for notification bar

Hello community,
i want to ask how can i implement conditional filters either via code or other means for notification bar such that only some set of user group can see it.

thanks

Just for clarity, there are two different kinds of list filters: conditional filters and inline filters. A conditional filter runs on the server and restricts what data is sent back in the web page. An inline filter runs in the browser window, so all the data is available and the user can filter it in or out.

With that in mind: there’s no way to programmatically affect conditional filters. They are defined in the List block and they can only be modified manually in the studio.

However, it is possible to control inline filters with the page URL. See the docs for more info.

OK, I re-read your post, and now I think I misunderstood what you mean by “conditional filter”. Now I think maybe you were asking if it is possible for the inline filters in a List block to be shown or not depending on whether a user is in a particular user group.

If that is what you were asking, then the answer is that there’s no Softr feature for this. If you really wanted to make it work, you might be able to hack some custom code to do it, but I’m not sure.

OK, one more try. Maybe you were asking if it was possible to show a notification in the notification bar only to some users (e.g., in a group) instead of all users. If so, I have no clue.

yes this is exactly what i meant in the question.

Got it. I think it would be possible to make this work by adding some additional JavaScript to the generated code that tests to see if the logged-in user is in a specific group before displaying the notification.

yeah i thought as much

but i dont have knowledge in Javascript

I figured out how to do it without having to write any custom code. Here’s what I did:

  • generated a notification bar and copied it to the clipboard
  • went to my site’s home page and added a custom code block and configured its styles to take up as little room as possible
  • pasted the notification bar’s code into the custom code block
  • configured the custom code’s block to be visible only to users in a certain group

This is the best way to do it if you only need the notification bar to appear on a small number of pages. If you really need it to appear on every page of your site, then this approach might get hard to manage.

wow my thought didn’t go through that. okay I’ll give it a try

so here is the issue how the custom code block will be above the header?

The notification bar code actually does the work to position the notification bar at the top of the page no matter where you put it, so it will work just the same from a custom code block at the bottom of the page as anywhere else.

okay that works thank you

can i quickly bring on the case study of the custom code page reloading i ask in a specific tag

Sorry, couldn’t quite make sense of that - can you explain?

so i am referring to this question here… on auto page reload

now the code @matthieu_chateau recommended a code and it did work for the page refresh

but here is the issue, the page keeps reloading contionusly befitting the purpose for the reloading, i expect after stripe payment made on checkout page and goes to the homepage, it automatically reload once, but it kept reloading