I created a little module that defines a new content type called 'nodeblock'. When you add a nodeblock node its title will show up on the Blocks page. From here you can enable the block and do whatever you want with it.

Although this achieves the same effect as creating a block and putting something in the body, the beauty is that you don't have to give your clients or lower-level users access to the ugly admin/block page. Also you have more power with a node than with a block.

The last thing it does is add an 'edit' link inside the block (if you have the correct permissions)... which is very convenient for end users. After editing, they will be sent back to the referring page.

If you like the module or are interested in it maybe I'll see if I can get it into CVS and on the modules page.

<?php
// $Id: nodeblock.module,v 0.1 2006/11/06 00:00:00 chud Exp $
function nodeblock_help($section) {
  switch (
$section) {
    case
'admin/modules#description':
     
// This description is shown in the listing at admin/modules.
     
return t('A custom node type that can be enabled as a block.');
    case
'node/add#nodeblock':
     
// This description shows up when users click "create content."
     
return t('A custom node type that can be enabled as a block.');
  }
}
function
nodeblock_node_info() {
  return array(
'nodeblock' => array('name' => t('nodeblock'), 'base' => 'nodeblock'));
}
function
nodeblock_access($op, $node) {
  global
$user;
  if (
$op == 'create') {
   
// Only users with permission     to do so may create this node type.
   
return user_access('create node blocks');
  }
 
// Users who create a node may edit or delete it later, assuming they have the
  // necessary permissions.
 
if ($op == 'update' || $op == 'delete') {
    if (
user_access('edit own node blocks') && ($user->uid == $node->uid)) {
      return
TRUE;
    }
  }
}
function
nodeblock_perm() {
  return array(
'create node blocks', 'edit own node blocks');
}
function
nodeblock_menu($may_cache) {
 
$items = array();
  if (
$may_cache) {
   
$items[] = array('path' => 'node/add/nodeblock', 'title' => t('node block'),
     
'access' => user_access('create node block'));
  }
  return
$items;
}
function
nodeblock_form(&$node) {
 
$form['title'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Title'),
   
'#required' => TRUE,
   
'#default_value' => $node->title,
   
'#weight' => -5
 
);
 
$form['body_filter']['body'] = array(
   
'#type' => 'textarea',
   
'#title' => t('Body'),
   
'#default_value' => $node->body,
   
'#required' => FALSE
 
);
 
$form['body_filter']['filter'] = filter_form($node->format);
  return
$form;
}
/**
* theme the edit link
*/
function theme_nodeblock_edit_link($nid) {
 
$output = '<div class="nodeblock-edit-link">';
 
$output .= l(t('edit'), 'node/' . $nid . '/edit', array(), 'destination=' . $_GET['q']);
 
$output .= '</div>';
  return
$output;
}
function
nodeblock_block($op = 'list', $delta = 0, $edit = array()) {
  if (
$op == 'list') {
   
// get list of nodeblock nodes from db...
   
$result = db_query("SELECT * FROM {node} WHERE type = '%s'", "nodeblock");
    while (
$row = db_fetch_object($result)) {
       
$blocks[$row->nid] = array(
                                       
'info' => $row->title,
                                       
'weight' => 0,
                                       
'enabled' => 0,
                                       
'region' => 'left',
                                    );
      }
    return
$blocks;
  }
  else if (
$op == 'configure' && $delta == 0) {
       
// no config options
 
}
  else if (
$op == 'save' && $delta == 0) {
   
variable_set('nodeblock_block_items', $edit['items']);
  }
  else if (
$op == 'view') {
       
$node = node_load($delta);
        if (
user_access('edit own node blocks') && ($user->uid == $node->uid)) {
       
$content = theme('nodeblock_edit_link', $node->nid);
    }
       
$content .= $node->body;
       
$block = array('subject' => $node->title, 'content' => $content);
    return
$block;
  }
}
?>

Comments

I thought this was a good idea (with a few minor modifications). I've checked in my module to CVS: http://drupal.org/project/nodeasblock

If you'd like CVS access to module (to be an official maintainer), just leave me an issue in the issue queue and I'll add you right away.

Cheers,
-Mark

--
http://www.advantagelabs.com

--
Want managed Drupal hosting? I recommend:
http://www.advantagelabs.com

Hey Mark,

I like what you did with it... and I have a couple more ideas... will submit to the queue.

Colin

This is quite similar to the Side Content module, which displays a field from the node as a block. The block being part of the node means that it gets correctly indexed by the search function, and also displays as part of the page if using the print module. Also the block can be created/edited/deleted at the same time as the node.

I guess one advantage of nodeblock is that a user that doesn't have permision to edit the page could be given permision to edit just the block.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

The (much) bigger difference is that side content only appears when the user views the node in page mode. From the project page:

The content will only be seen when viewing the page (node) that it's been added to.

This will allow the content to be displayed elsewhere in the site. The side content behavior could be recreated by editing the block configuration in admin/block and setting it to only display on the node's page.

Side content is a good module, but one with a different goal. It aims to provide pullquotes from the text (or something similar), while nodeasblock is closer to an advertisement for a node.

-M
--
http://www.advantagelabs.com

--
Want managed Drupal hosting? I recommend:
http://www.advantagelabs.com