Needs work
Project:
Nodeblock
Version:
6.x-1.4
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Reporter:
Created:
18 Mar 2010 at 07:38 UTC
Updated:
15 Nov 2011 at 19:27 UTC
Jump to comment: Most recent file
I need the ability to place nodeblocks but another user with only edit and publish permission will be editing nodeblocks and change the status.
Currently if you un-publish a nodeblock all its block settings are lost and when your re-publish the nodeblock you have to replace it in a block region and re-set its visibility settings.
To achieve what I want I made the following small changes.
Hope somebody else finds it useful.
Change 1:
nodeblock_nodeapi() – move message to only be on insert
case 'insert':
case 'update':
drupal_set_message(t('The block you just created is now available on the <a href="!url">block configuration page</a>.', array('!url' => url('admin/build/block'))));
TO
case 'insert':
drupal_set_message(t('The block you just created is now available on the <a href="!url">block configuration page</a>.', array('!url' => url('admin/build/block'))));
case 'update':
Change 2:
nodeblock_block() – changed SQL to not filter by status
if ($op == 'list') {
foreach ($types as $type) {
if (nodeblock_type_enabled($type)) {
// Fetch all nodes of this type, excluding translations.
$result = db_query("SELECT nid, title FROM {node} WHERE type = '%s' AND status = 1 AND (nid = tnid OR tnid = 0)", $type->type);
while ($node = db_fetch_object($result)) {
$blocks[$node->nid] = array('info' => $node->title .' (nodeblock)');
}
}
}
return $blocks;
}
TO
if ($op == 'list') {
foreach ($types as $type) {
if (nodeblock_type_enabled($type)) {
// Fetch all nodes of this type, excluding translations.
$result = db_query("SELECT nid, title FROM {node} WHERE type = '%s' AND (nid = tnid OR tnid = 0)", $type->type);
while ($node = db_fetch_object($result)) {
$blocks[$node->nid] = array('info' => $node->title .' (nodeblock)');
}
}
}
return $blocks;
}
Change 3:
nodeblock_block() – changed view to check status of node
elseif ($op == 'view') {
$node = node_load($delta);
if (!node_access('view', $node)) {
return;
}
TO
elseif ($op == 'view') {
$node = node_load($delta);
if (!node_access('view', $node) || !$node->status) {
return;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | nodeblock_publishing.patch | 1.64 KB | igor.ro |
Comments
Comment #1
tom_o_t commentedI actually came across a similar issue to this yesterday using an unpublished nodeblock in panels.
The only thing I'm concerned about here is confusion when someone places an unpublished block in a region and then can't figure out why it doesn't show on the page. Any thoughts on something in the user interface to address this?
I'm about to head out on vacation, so won't fix this until next month, and I don't think I'll commit this fix without an improvement to the way unpublished nodes would be dealt with.
The first change you made should probably be a separate issue - it's not really related to this, but is a worthwhile fix.
Patches are encouraged here - makes committing the fixes easier and more likely to happen sooner!
Thanks for your help.
Comment #2
NaX commented@tom_o_t
My suggestion when it comes to your concern about usability would be to put a message up when nodeblocks are unpublished.
Sorry about not submitting a patch, but I am currently working from an XP machine and have not had time to workout how to create a proper patch with WinMerge. I remember seeing docs about WinMerge in the handbooks, maybe I should try and find it.
If feel the message change I suggest is indirectly related, because when I unpublish a nodeblock I get a message saying "The block you just created ..."
Enjoy your vacation.
Comment #3
igor.ro commentedThanks NaX.
It is realy usefull thing.
Here is a patch based on your changes.
Comment #4
altavis commentedI think the best solution to usability issue pointed by tom_o_t is to modify line 96 and add maybe ' (nodeblock-unpublished)' if necessary.
Comment #5
aaron stanush commentedAdmins should definitely have the ability to unpublish nodes, while still having users be able to view the block. You wouldn't ever want a user to land on a page that displays an individual block, right? I was hoping that when the block was created from the node, it would use block-level permissions rather than the access permissions of the node. This way, you could use access control to make the nodes inaccessible to anonymous users, but they could still see the blocks.
Using this patch, I was still unable to have anonymous users view unpublished nodeblocks. Am I missing something?
Comment #6
igor.ro commentedyes. as I remeber problem was in settings of block and region where it is placed. so seq. unpublish->publish and now you need to set thab block to the region again.
Comment #7
aasarava commentedI've tested the patch in #3 and it works as advertised. It's been a long times since it was submitted. Maintainer, can it be added to the next release?