Members of hidden groups in no_ads_for_groups still see ads

I need some help with the Discourse Ad Plugin please.

I am trying to display adverts to everyone, logged in or logged out, regardless of Trust Level, unless they are a member of group “extra_special_members” - in which case they should be excluded and not see any adverts.

I’ve changed setting adsense through trust level and set this to TL4 (meaning anyone at any Trust Level will see adverts).

I’ve also changed setting no ads for groups and applied only one group, that of “extra_special_members” (meaning users in this group will not see adverts)

My test user is TL2 and is a member of the “extra_special_members” group members - but my test user is still being served adverts.

Is this a bug? :thinking:

Or is the adsense through trust level setting somehow overriding the no ads for groups setting? :thinking:

I’ve just edited my settings to make it clearer, if someone can try to replicate please.

I have found the cause of the issue.

My group of “extra_special_members” has visibility set as:

Who can see this group? Group owners

Who can see this group’s members? Group owners

This is set so members of this group cannot see each other, and more importantly, the number of people in this (sensitive) group does not leak out.

If I:

  1. Create a group called “hide-ads-test”
  2. Set the visibility set to “group owners, members and moderators”
  3. Add my TL2 test user group “hide-ads-test”
  4. Add the “hide-ads-test” group to the no ads for groups setting

Then my TL2 user can no longer see the adverts.

As soon as I change the group visibility from “group owners, members and moderators” to be “Group owners” then the adverts instantly re-appear :pensive:

It’s as if the ad plugin can’t see the group, so it just shows the adverts :thinking:

1 Like

Could any developer confirm if this is a bug please? :thinking:

If it’s not a bug then I’ll set about creating a paid gig for a fork of the plugin :blush:

Yeah this is an issue.

The ad plugin performs all the logic of “show or do not show” ads based on group and trust level information it gets from the server.

Given the group membership is hidden to the user, the client has no way of figuring out the ads need to be hidden.

The code needs to be rewritten so the logic lives on the server side (probably a field on current user says "this user has ads, or this user has no ads). This is a rather big change cause so much of the logic now is implemented in JavaScript and it needs to move to Ruby.

I am putting a pr-welcome on this, if we have a few repeat requests for it I will consider fast tracking. It is a complex change.

1 Like

@sam I’m very grateful for the detailed explanation, thank you.

I’ll try and come up with an initiative work around :blush:

1 Like