I want to have a banner than I can pass a callback message to users with.
So for instance if they access a page that is behind a payment wall, I want to redirect them to the payment / subscription page and show the message banner with “you need to subscribe to access that” or similar message.
I have a re-useable Group element at the moment with a custom state of “message” that is hidden if it’s content is empty.
The problem I am having is that I cannot set the state of the banner and have it persist from one page to another.
The only other thing I can think of is that I need to store user messages to the DB and load any messages page to page, I would rather not do that though.
Thanks for you reply, that only really works if I have a bunch of pre-saved banners with fixed messages that I am flipping on and off. What I really want is to have one banner with dynamic content that I can change as needed, the toggling I can then do for warning/info styling.
I don’t want to have to put big blocks of text in the url as parameters although technically I could.
Only other solution I can think of would be to set a cookie on that user to carry the message. Haven’t used it myself but I believe there is a “cookies/local storage” plugin.
well I guess it at least keeps the page building side of things lower as I just need to manage the option set. To be honest though, if I was to implement this option I think I would rather just have a “message” table with [user,message,messageType] that populated the group on any page and deleted the message (or archived it) once dismissed.
I think I follow and yeh, that makes sense.
The nice thing with Option Sets is that they’re snappy as they don’t require any DB lookup and come pre-loaded with each page.
I will have a think on it, it certainly has a degree of re-usability and easy maintenance that I think I too quickly dismissed. I think the telling point will be how many standard message examples I have and whether they need any dynamic content from a prior action. I guess depending on the dynamic content I could cobble together the two avenues of URL param and option set.
Perhaps not the most lightweight option, however this should do what you want.
Create a text field in user called “banner message”.
Setup a conditional workflow on the page with the condition when current user’s banner message is not empty. (Bonus points: You need only add this conditional workflow once to a reusable banner element.)
In the workflow, you can send the data from the field to your banner. If you only want to show this message once, then you can clear “banner message” by updating the user’s thing.
Caution: if your user has multiple sessions open, the message will be sent to all those sessions with the above. This may or may not be desirable. Similarly, if the next window is never opened and then the user returns later on, the last out of date message will be shown. The work-arounds for both of these situations would be to use some kind of logic / state variables to only load “banner message” once on page load and to delete old banner messages automatically.