If a user (normally admin) has permissions to view an unpublished node then the nodeblock for that node will appear to them even if other users can't see it. This may well be expected behaviour but the nodeblock isn't configurable as it no longer exists in the block management page and this makes it tricky to deal with or track down.
I can see three ways to go:
- Blanket hiding of all unpublished nodes
- Leaving them configurable in the block management page
- Making their display configurable on a type and/or per block basis
The first is a one line change (when checking if the node is viewable in nodeblock_block_view() just add a check for status:
if (!node_access('view', $node) || $node->status == 0) {
return;
}
The second is a whole can of worms I'm not ready to go for, and the third option is in the attached patch.
Any thoughts on this?
Comments
Comment #1
michaellander commentedHmm. Good find.
I like 2 because it has the smallest chance of impacting sites already using the module(of which may be using the unpublished display). Let me look into this a bit and see what I can find. Thanks!
Comment #2
tobyontour commentedPersonally I'd be keen to have option 3 in there as well as leaving them configurable if they were set to still be visible if unpublished. The reason I discovered it was because the behaviour was unexpected (although technically justifiable).
If the patch (or some similar system) was implemented then the current behaviour would be maintained unless it was set to do otherwise in the configuration.
Comment #3
tobyontour commentedJust in case anyone cares, here's the patch for option 1.
Comment #4
mesr01 commentedAnd here's one for option 2.
Comment #5
mesr01 commentedOops, error in patch header. Here's a new version.
Comment #6
Johnny vd Laar commentedI've committed this option: http://drupal.org/node/1396336#comment-6266466 (option 2).
Thank you for the patch.