Hi,

Thanks for this nice module. Just what we needed!

I hacked the visibility.
Cause when adding a node to a block:

  • the visibility from the block and the other nodes in this block is set the same.
  • all pages set a * in the block-visibility.... when block is set to show-all-except... getting the * ...

So I just removed the visibility-saving in _nodesinblock_save()
Now each node has its own visibility, which works just fine :-)
And the block is handle in the blocksettings

I hope this info helps.
Greetz, Joly

Comments

swentel’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not entirely sure what you mean here, do you have some example code to show me what you've done ?

joly’s picture

>
function _nodesinblock_save($node, $op) {

  // Delete old record.
  db_query("DELETE FROM {nodesinblock} WHERE nid = %d", $node->nid);

  // Save if node is not deleted
  if ($op == 'delete') {
  	return;
  }
// vfDebug($node,'trace'); 
  
  $nodeinblock = new stdClass;
  $nodeinblock->nid = $node->nid;
  $nodeinblock->delta = $node->nodesinblock_delta;
  $nodeinblock->title = trim($node->nodesinblock_title);

  if(!$nodeinblock->delta && !$nodeinblock->title){
  	// dont save when no block is set and no title is set
  	// else we have a table full with empty records
  	return;
  }

  $nodeinblock->weight = $node->nodesinblock_weight;
  $nodeinblock->status = $node->nodesinblock_enable;
  $nodeinblock->visibility = trim($node->nodesinblock_visibility);
  $nodeinblock->render = $node->nodesinblock_render;
  $res = drupal_write_record('nodesinblock', $nodeinblock);
//  vfDebug($res,$nodeinblock);
  
  
  // saving visibility removed
  // it was a bit buggy 
  // and now any node has its own visibility setting
  // it seems to work nicely

  // Get visibility paths.
//  $visibility = array();
//  $result = db_query("SELECT visibility FROM {nodesinblock} nib INNER JOIN {node} n on n.nid = nib.nid WHERE nib.delta = %d AND nib.status > 0 AND n.status = 1", $node->nodesinblock_delta);
//  while ($row = db_fetch_object($result)) {
//    $node_visibility = explode("\n", $row->visibility);
//    foreach ($node_visibility as $path)
//    $visibility[] = trim($path);
//  }
//
//  // Update blocks table.
//  $visibility = array_unique($visibility);
//  db_query("UPDATE {blocks} set visibility = %d, pages = '%s' WHERE module = 'nodesinblock' AND delta = %d", variable_get('nodesinblock_visibility_'. $node->nodesinblock_delta, '1'), implode("\n", $visibility), $node->nodesinblock_delta);
}

<

NB.
I have also made a title-field to overrule the node-title

swentel’s picture

Status: Postponed (maintainer needs more info) » Postponed

Ok, it took me a while to answer, sorry about that. I'm going to postpone this for a while and think about it. The 'Show on every page except the listed pages.' is indeed tricky - I only recently added that and cause some strange problems, I need to rethink that setup completely. More for later !

swentel’s picture

Status: Postponed » Closed (works as designed)

Ok, I'm going to mark this as design, I added a small UI change in the selection of the box, so people know what type of block it is that they are going to choose.