Creating a banner that only 1 group can see, while the other groups don't

I wrote about this in the Versatile Banner Plugin Topic but I realized it might work better as it’s own post, so here it is:

Thanks for the awesome tool.

I’m so close to creating what I need. I don’t know if anyone has any ideas, or if this could be implemented into versatile banner.

This is the banner I created

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!

Thanks!

My CSS is improving, though still rudimentary :slightly_smiling_face:, but I think you could do something like this as long as the Trial group was set to be their primary group:

.banner-box {
	display: none;
}

.primary-group-trial {
   .banner-box {
       display: initial;
   }
}

So the first bit hides it from everyone, and the second then shows it to members with the ‘trial’ group as their primary.

1 Like

thank you so much! I’ll experiment with it

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

Thanks a lot

@JammyDodger I totally forgot the fact that I need users without accounts to also see the banner.

In that case do you think there’s a way where instead of only showing to “trial-group”

instead making the CSS so that it’s only hidden from “paid-members group”

That’d be incredible!

It seems that anon is a class you can use there as well. :+1: 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. :slightly_smiling_face: 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

1 Like

This component should allow you to expose non-primary groups as body tag classes:

I think you’d do something like:

body.group-trial {
   .banner-box {
       display: initial;
   }
}

This will only work if the users of the trial group have permission to at least see that the group exists.

2 Likes

thanks a lot I’ll try that out, that might be the solution I need! thanks @tshenry and @JammyDodger for the incredible help!

2 Likes