It's pretty much all in the title. The ad slot blocks do respect the visibilty by role block settings. I have the ads disabled for the administrator and moderators but they remain.

Comments

highvoltage’s picture

The ad slot blocks do not respect the visibility by role block settings.*

Couldn't edit...

toemaz’s picture

Nice catch. Any chance of providing a patch?

highvoltage’s picture

I'm not a php programmer sadly. The best I can do is simply report the issue. Sorry x_x.

toemaz’s picture

While rereading this issue, I wonder whether it is really a bug in this module. I presume you do wish to show the block for auth users? If so, admin and mods are auth users as well which means that the block will be visible to them as well. Does this make sense to you?

highvoltage’s picture

I want to hide the ad blocks from moderators and administrators.

Display by role works for normal blocks... If all roles were treated as 'authenticated' first and another role(like moderator) second in terms of determining visibility there would be no hiding by role at all except those who were logged in and those who aren't.

Maybe i misunderstood you?

toemaz’s picture

@highvoltage You're correct indeed.

Accepting patches.

jaydub’s picture

Category: bug » support

As others mentioned, as long as you have 'authenticated user' role selected in block visibility by role it won't matter what other roles you have selected or not selected as all users in roles other than anonymous or authenticated will automatically receive the 'authenticated user' role and so the block visibility will not work in the way you wish.

What you can do is use the page specific block visibility settings and use a small snippet of PHP code to check if the user has the roles you want to exclude and if so do not display the block.

The example below would allow you to exclude the block from display when the current user is in the role(s) listed in the IF test:

<?php
global $user;
if (count(array_intersect(array('Role One, Role Two'), $user->roles))) {
  return FALSE;
}
return TRUE;

?>
jcisio’s picture

Status: Active » Fixed

This is a "by design" of Drupal blocks.

#7 gives an idea to have it done.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.