Hi, I like this module, save lots of time for me.

I found the permissions of "Hide AdSense" is limited to hide adsense blocks, not for Auto ads. And in "Auto ads visibility" setting page, it can be controlled by url pattern only.

I am wondering if visibility based on roles is possible in future version? It would be very useful for website constructors to implement a ads system based on memberships.

Comments

tky created an issue. See original summary.

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

'Hide AdSense' hides auto ads as well.

I don't see what can be gained by adding a 'Hide AdSense auto ads' permission.

tky’s picture

Hi, jcnventura,

Thank you for your reply. Let me explain the situation for requirement of 'Hide AdSense auto ads' permission.

Say, my site has memberships in different levels. Paid members have a privilege to see no ads which free members haven't.
In drupal, these two group of members can be assigned different roles, therefore got different permissions of ads display, ideally.

For now, as I know, the site builder can control the permission of "Hide AdSense" by role when he installed this module. But the permission is not included 'Hide AdSense auto ads'. As a result, you can only hide ads in adsense blocks but still see the auto ads all the time, if you enabled auto ads in both Adsense and the module configuration. Even you are the super user.

If you want to build a membership system like I do, you will need a permission to hide ANY ad from Adsense, no matter it is came from ad unit or auto ads. After all, you cannot make your members happy if you promised them an ad-free privilege but they still see auto ads all the time.

You would be more concentrated in site maintenances if you has administrator role with such permission. This is another benefit you can get.

jcnventura’s picture

The current permission hides ANY ad from adsense. That's what the code does, and that's what I just tested.

Something is not working right in your case.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info in some time. Please set back to active with steps to reproduce the problem, if you are still having this issue.

mutuku’s picture

I am experiencing the same issue. I do not want the admin to view auto ads. "Hide AdSense" is enabled in permissions, but I can still see the ads. My adsense version is 8.1.1

promo-il’s picture

adsense.module

function adsense_page_attachments(array &$attachments) {
  /*WT+:Disable Auto-ads for roles with access 'Hide AdSense'*/ if( \Drupal::currentUser()->hasPermission('hide adsense') ) RETURN;
  $config = \Drupal::config('adsense.settings');