By Frodo Looijaard on
I'd like to discuss block visibility.
Sometimes blocks should be visible; sometimes not. As far as I can tell, at the moment we have:
- Blocks are globally disabled or enabled
- Some blocks are only shown if your role has the right permissions
- You can select whether users can hide/show certain blocks
What I would like to see added, is:
- Some blocks are only visible for some roles
The most important thing here is the distinction between an anonymous user and other users. I would like to hide most blocks for all anonymous users, as almost everyone has to get an account on my site. I guess that would be enough, but you could extend this to specifying visibility for all roles. - Better control over default visibility
When a user can select whether a block is visible or not, it would be nice to be able to specify a default. At this moment, it seems that it always defaults to off (this may be a bug in 4.3.2).
A simple user-interface implementation would be to extend the admin/system/block screen:
- Enable checkbox (unchanged)
- Anonymous checkbox (new: whether anonymous readers can see this)
- A Visibility selection menu (replaces custom: when this block is visible)
- Always (user can't disable/enable it)
- Default on (but user can disable it)
- Default off (but user can enable it)
If we would want to specify availability for each role, this would better go into a separate screen, I think.
Comments
yes, anonymous is a special case
I agree, especially with the comments on anonymous visibility. But the default setting is currently a problem too. Many users won't find the default off blocks as they are now.
Intention
The way it is supposed to be...
If 'custom' is off:
- 'enabled' specifies whether or not the block is visible
If 'custom' is on:
- 'enabled' specified the default status
- A registered user can override this setting through 'my account'.
The defaulting when 'custom' is on is actually broken now and will get fixed for 4.4. The only problem is that this is a bit counter-intuitive (people expect 'enabled' to turn a block off regardless of 'custom'). On the other hand, the current approach has the least checkboxes/UI elements.
Perhaps a better label for 'enabled' would be 'default status' and 'custom' would be 'allow user override' or something like that.
hiding blocks from authenticated users
The converse is also true: It would be great to be able to hide blocks from authenticated users. This is already how the user login block works... but I want to create my own user login block and hide it from authenticated users.
Like you say, the solution is role-specific blocks.
Blocks per role would be nice to have
Blocks per role would be nice to have. It certainly is a recurring feature request and I, too, can think of various interesting use cases. Someone submitted a patch for it, but the patch needs to be improved upon.
Blocks visibility in 4.6RC
Blocks visibility in 4.6RC seems to be flawed.
I just tried limiting certain blocks to be displayed only from the forums, polls, and weblinks, but when going to the forums or other nodes I wanted the blocks displayed......they weren't there.
Bug?
Once I turned the "show on specific pages" off they were once again displayed on all pages.
It seems if they are restricted in any way, they don't show up anywhere.
I just made an update ;)
I did post the patch to View blocks by role. It's now updated, and I'm added some little more code regarding of drumm observations.
Feel free to submit feedback.