A user seeks a way to display a banner exclusively to members of the “trial” group in Discourse, while hiding it from paying members and users without accounts. santiyounger initially explores using the Versatile Banner plugin but faces limitations with visibility and closing permissions. JammyDodger suggests a CSS solution using the primary-group-trial class, which works only if “trial” is the user’s primary group. santiyounger notes this is a limitation since some users have different primary groups. JammyDodger then proposes using the anon class to show the banner to unauthenticated users. tshenry recommends the discourse-groups-css-classes-in-body plugin, which adds a body.group-trial class to allow targeting users in the “trial” group regardless of their primary group, provided they can see the group. santiyounger expresses gratitude and plans to test the solution.
However I only want that to appear to people in my Discourse group “trial” I don’t need my paying members to see this banner at all which is why I wrote
If you are already a member you can close this message
However, that’s still a flawed solution.
Another issue is that the “Learn more” button link is a private link for members in “Trial Mode” since paying members don’t have access to the group where that link takes the user.
Also I wouldn’t want trial members to be able to close the banner, (I only want paying members to be able to close it)
Does anyone know of any work arounds I can do to make the banner only appear to members of the trial group?
I’d love to find a solution with versatile banners, since it looks great, but I’m open to other ideas!
My CSS is improving, though still rudimentary , but I think you could do something like this as long as the Trial group was set to be their primary group:
unfortunately I do have another primary group set-up for some users. Do you think primary group is the only way? is there no way to just make so as long as someone belongs to “trial group”
If it must be primary, that might be a sacrifice I might have to make since this is a genius solution
It seems that anon is a class you can use there as well. So you could add something like this to the bottom:
.anon {
.banner-box {
display: initial;
}
}
I think I have seen a way to insert a class, though its not something I’m fluent in. I’ll see if I can find the topic I’m thinking of, and check I’ve understood it properly.
that’s be incredible, your CSS trick worked incredibly well! the only missing piece would be to achieve it without primary-group, but just as long as someone belongs to that group