I needed that the Display Suite block fields respect the role and page visibility settings that are set up in block administration.
After looking into Context Respect module which provides the same functionality for Context module I made a patch for Display Suite.

Comments

StatusFileSize
new2.02 KB

Here's the patch.

StatusFileSize
new2.01 KB

Fixed some typing errors in the patch.

Status:Active» Needs review

Category:bug» feature
Status:Needs review» Needs work

There's spaces in the patch, and this was intented by design, not a bug report.

Status:Needs work» Needs review
StatusFileSize
new2 KB

Removed the spaces.

@swentel,

I need this functionality as well. Basically I have an event that utilizes the registration form. Only logged in users can register for my events so I wanted to create a simple block that says: "you must be logged in to register" and use the block default visibility settings.

Because I am using Display suite for my layout I would like to position that custom block field but only want it to show for anonymous users.

Title:Block field respects block visibility settingsBlock field Doesn't respect block visibility settings

Status:Needs review» Reviewed & tested by the community

@ martins.bertins

I just applied your most recent patch. Applied cleanly and now the blocks respect the default settings THANKS !!!!!

ps- at first I didn't think it was working but realized I was logged in as User 1. After I logged in with a different user it worked.

I can confirm that the patch is working as expected. This should find its way into the commit list soonish. Quite an important and powerful change.

*UPDATE*

I spoke too soon. It worked for about five minutes and then (once the cache was cleared) I started getting:

Warning: include() [function.include]: Failed opening '.tpl.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in theme_render_template() (line 1495 of /includes/theme.inc).

It seems to open up a hole and "forgets" what theme bits are being loaded. Unsure if it is related but, if I return to the original ds.module file, the problem goes away.

Patch #5 worked for me, installed on commerce kickstart.

Doesn't work in my case. I use "Show block on specific pages" and "Content type" combined and when I combine the two, block is not displayed in those cases. Thinking of giving up on using DS for views as it just makes a mess.

Status:Reviewed & tested by the community» Closed (works as designed)

I'm sorry, but the visibility doesn't fly here for these kind of blocks.

@Swentel,

Does the patch in #5 not fix the solution ? Is there a reason you do not want to include this patch ?

Status:Closed (works as designed)» Needs work

Talked to Mārtiņš at DrupalCamp Baltics.

The problem with the current patch is following: committing it like this would mean that suddenly visibility settings will kick on existing sites in case a block is also used on other places. This is not desired behavior, so it means we need an extra setting on the block field. Something like 'respect visiblity settings.

Another better option also than the current patch is probably just calling drupal_alter('block_list); which then would mean all kind of visibility settings would work automatically out of the box (pages, content types, php, language etc).

Issue summary:View changes
StatusFileSize
new2.05 KB

Exactly the same code as provided in #5, but updated line numbers so it can patch with DS 2.6

Thank you for this patch. Works nicely. Using DS 2.6.

I agree with #14 so a committable patch would go in that direction.
I fixed this for the drupal 8 version, so we don't have any issues there.

Version:7.x-2.2» 7.x-2.x-dev

Just applied the patch from comment #15 and it doesn't appear to be affecting block visibility settings for restricting anonymous users.

What I am trying to do is hide particular blocks from anonymous users. I created the blocks and set their role visibility settings to "authenticated user" only, by checking only that roles' checkbox. I then created Display Suite custom block fields for each block and placed them on their view mode and pages. When logged out I can still see these blocks.

What's weird is that if I do the opposite and restrict a particular block from people who are logged in that works just fine, so that part is working, but I really need to hide things from anonymous users as well.

Thanks for any help in advanced!

Update:

I was able to able to configure role permissions for individual fields once I enabled "Field permissions", using the Display Suite Extras module.

I am using a block to show adsense ads on nodes, but the block are also shown on node and comment preview pages and is a undesirable function for me. Trying to restrict the block in specific paths doesn't works with ds 2.6.