After some playing (and difficulties in upgrading) with Xoops CMS, I decided to give drupal a go.
All is going well, I managed to get nearly everything to work.
The only big thing I am missing is a good site guestbook for anonymous users.
I tried the guestbook module, but I only get the user guestbooks, no site guestbook. And there is no email, home page field, or htmlarea support...
Is there a better guestbook module in development, or does someone has a suggestion for me ?

I tried to make a content type for a guestbook entry, but I don't know how to get all the entries in one single page, and a button to add another entry.

Someone has a working guestbook in 4.63 ?

Thanks in advance,

Steven

Belgian boyscouts group (in dutch)

Comments

venkat-rk’s picture

Well, you could try installing the flexinode.module which gives the flexibility to add a new content type with custom fields. Might be the solution you are looking for:
http://drupal.org/project/flexinode

Also, you might be interested in a scouting module that is in the works- it is UK specific at the moment. I mentioned it seeing that you are into Scouts too:
http://drupal.org/node/24729

You can try the demo by logging into the test site with your drupal.org user account.

4p’s picture

I was also in need for a simple sitewide guestbook.

Today I wrote my own based on http://drupaldocs.org/api/4.6/file/contributions/docs/developer/examples...

You can see an example on http://www.dierenambulance-purmerend.nl/test/?q=guestbook which will move later on to http://www.dierenambulance-purmerend.nl/guestbook

If you or someone else is interested in the code I will of course share it.

Jos

pobster’s picture

Well, not entirely as your module is verrrrrry nice looking :o) But yes the guestbook module *does* do a site guestbook. Its located at www.yoursite.com/guestbook/0 (on clean urls).

Check it out on my site here:

www.ciclosuno.com/guestbook/0

Of course, you have to change the access control to stop people from having their own guestbooks and only be able to use the sites one (which means just having everything unselected - everyone *can* access the sites guestbook anyway as long as you add a link to it in your menu so they know where to go!)

Pobster

4p’s picture

I agree it was some kind of re-invention. I had the choise to adjust the existing guestbook module fit my needs (url and email fields) or write my own. Because I'm a drupal starter and in a process of learning to write modules I decided to write my own.

pobster’s picture

Maybe you should submit it as a module? It looks good! Neat and simple.

Pobster

jtravs’s picture

I'm also looking for an improved guestbook module. Any chance of seeing your code or of you submitting it as a new module?
John

Jim@drupal.be’s picture

I have taken a close look at your website. Your guestbook is everything I was looking for. Can you share it with me or in the drupal CVS directory??

4p’s picture

You can download the module shown on http://www.dierenambulance-purmerend.nl/?q=guestbook
from http://www.4pages.nl/drupaldownloads/simple_guestbook.zip
The module is made for a drupal 4.6 site and is not ready for 4.7.
The module needs the following table which also can be found in the remarks inside the module.

   CREATE TABLE simple_guestbook (
     nid int(10) unsigned NOT NULL default '0',
     guest_name varchar(60) NOT NULL default '',
     mail varchar(64) default '',
     url varchar(255) NOT NULL default '',
     PRIMARY KEY  (nid)
   )
pobster’s picture

// $Id: simple_guestbook.module,v 2.0 2006/03/17 4p Exp $

/**
 * @file
 * This module adds a simple guestbook to your drupal website
 * Database definition:
 * @code
   CREATE TABLE simple_guestbook (
     nid int(10) unsigned NOT NULL default '0',
     guest_name varchar(60) NOT NULL default '',
     mail varchar(64) default '',
     url varchar(255) NOT NULL default '',
     PRIMARY KEY  (nid)
   )
 * @endcode
 */

function simple_guestbook_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      return t('Add a simple guestbook to your site.');
    case 'node/add#simple_guestbook':
      return t('Give us your reaction.');
  }
}

function simple_guestbook_node_info() {
  return array('simple_guestbook' => array('name' => t('simple guestbook'), 'base' => 'simple_guestbook'));
}

function simple_guestbook_access($op, $node) {
  global $user;

  if ($op == 'create') {
    return user_access('create simple_guestbook');  
  }

  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit simple_guestbook') && ($user->uid == $node->uid)) {
      return TRUE;
    }
  }
}

function simple_guestbook_perm() {
  return array('create simple_guestbook', 'edit simple_guestbook');
}

function simple_guestbook_link($type, $node = 0, $main) {
  $links = array();

  if ($type == 'node' && $node->type == 'simple_guestbook') {
    if (simple_guestbook_access('update', $node) && !user_access('administer nodes')) {
      $links[] = l(t('edit this entry'), "node/$node->nid/edit");
    }
  }
  return $links;
}

function simple_guestbook_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array('path' => 'node/add/simple_guestbook', 'title' => t('guestbook entry'),
      'access' => user_access('create simple_guestbook'));
      
    $items[] = array('path' => 'guestbook', 'title' => t('guestbook'),
      'callback' => 'page_simple_guestbook',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK); 
}

  return $items;
}

function simple_guestbook_form(&$node) {
  
  if (function_exists('taxonomy_node_form')) {
    $output .= implode('', taxonomy_node_form('simple_guestbook', $node));
  }

$form['guest_name'] = array(
  '#type' => 'textfield',
  '#title' => t('Name'),
  '#default_value' => $node->guest_name,
  '#size' => 60,
  '#maxlength' => 60,
  '#description' => NULL,
  '#attributes' => NULL,
  '#required' => TRUE,
);
$form['mail'] = array(
  '#type' => 'textfield',
  '#title' => t('Email'),
  '#default_value' => $node->mail,
  '#size' => 60,
  '#maxlength' => 60,
  '#description' => NULL,
  '#attributes' => NULL,
  '#required' => TRUE,
);
  (!isset($node->url) || $node->url == 'http://' || trim($node->url ) == '') ? $url = 'http://' : $url = $node->url;
$form['url'] = array(
  '#type' => 'textfield',
  '#title' => t('Website'),
  '#default_value' => $url,
  '#size' => 60,
  '#maxlength' => 60,
  '#description' => NULL,
  '#attributes' => NULL,
  '#required' => TRUE,
);
$form['body'] = array(
  '#type' => 'textarea',
  '#title' => t('Body'),
  '#default_value' => $node->body,
  '#cols' => 60,
  '#rows' => 20,
  '#description' => NULL,
  '#attributes' => NULL,
  '#required' => TRUE,
);

  return $form;
}

function simple_guestbook_validate(&$node) {
  
  if (isset($node->guest_name)) {
    $node->guest_name = strip_tags($node->guest_name);
    if (trim($node->guest_name) == '') {
      form_set_error('guest_name', t('You have to specify your name.'));
    }
  }
  
  if (isset($node->mail)) {
    $node->mail = strip_tags($node->mail);
    if (trim($node->mail) == '') {
      form_set_error('mail', t('You have to specify a valid email adress.'));
    }
    if($mail_error=user_validate_mail($node->mail)){
      form_set_error('mail', $mail_error);
    }
  }

  if (isset($node->url)) {
    $node->url = strip_tags($node->url);
    if (trim($node->url) == "") $node->url = 'http://';
    if (!valid_url($node->url, TRUE) && trim($node->url) != 'http://') {
      form_set_error('url', t('You have to specify a valid url.'));
    }
  }
  
  if (isset($node->body)) {
    if (trim($node->body) == '') {
      form_set_error('body', t('You have to specify a message.'));
    }
  }
      
}

function simple_guestbook_insert($node) {
  db_query("INSERT INTO {simple_guestbook} (nid, guest_name, mail, url) VALUES (%d, '%s', '%s', '%s')", $node->nid, $node->guest_name, $node->mail, $node->url);
}

function simple_guestbook_update($node) {
  db_query("UPDATE {simple_guestbook} SET guest_name = '%s', mail = '%s' , url = '%s' WHERE nid = %d", $node->guest_name, $node->mail,  $node->url, $node->nid);
}

function simple_guestbook_delete($node) {
  db_query('DELETE FROM {simple_guestbook} WHERE nid = %d', $node->nid);
}

function simple_guestbook_load($node) {
  $additions = db_fetch_object(db_query('SELECT guest_name, mail, url FROM {simple_guestbook} WHERE nid = %d', $node->nid));
  return $additions;
}

function simple_guestbook_view(&$node, $teaser = FALSE, $page = FALSE) {
  $node = node_prepare($node, $teaser);
  $guestbook_info = theme('simple_guestbook_node', $node);
  $node->body = $guestbook_info . $node->body;
  $node->teaser = $guestbook_info . $node->teaser;
}

function theme_simple_guestbook_node($node) {  
   $output = '<div class="simple_guestbook_node">';
   $output .= '<strong>' . $node->guest_name . '</strong> ';
   $output .= t('wrote on %date ', array('%mail' => $node->mail, '%guest_name' => $node->guest_name, '%date' => format_date($node->created, 'small')));
   $output .= '<br />';
   if ($node->mail != '') $output .= t('<a href="mailto:%mail" class="simple_guestbook_mail">email</a> ', array('%mail' => $node->mail));
   if ($node->url != '' && $node->url != 'http://') $output .= t('<a href="/%url" class="simple_guestbook_url" target="_blank">website</a> ', array('%url' => $node->url));
   $node->links .= '...';
  $output .= '</div>';
  return $output;
}

function page_simple_guestbook() {
  $listlength="10";
  $taxo_id = 7;
  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n LEFT JOIN term_node ON n.nid = term_node.nid WHERE n.type = 'simple_guestbook' OR term_node.tid = $taxo_id AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), $listlength);
    while ($node = db_fetch_object($result)) {
      $output .= node_view(node_load(array('nid' => $node->nid)), 1);
    }
  $output .= theme('pager', NULL, $listlength);
  
  print theme('page', $output);  
} 

Pobster

halftone’s picture

This works nicely, but does not seem to allow anonymous users to post, even with 'edit guestbook' set for them in Access controls, unless I'm overlooking something?

Regards
Tony Sleep

pobster’s picture

Do you mean you're using the above code or the actual guestbook module?

...Use the rewritten Guestbook module, it works just fine...

Pobster

halftone’s picture

Im using... as the title says - the downloaded code from from http://www.4pages.nl/drupaldownloads/simple_guestbook.zip

Works well, but appears not to permit anon posting.

I had tried the full Guestbook module but 'Guestbook(0)' invariably produced a page of debug info from my embedded Gallery2! Some sort of function clash, I guess. It was OTT anyhow for my simple use.

Regards
Tony Sleep http://tonysleep.co.uk

pobster’s picture

Odd... I used 4.6 with both Gallery2 and the guestbook module before with no troubles? Exactly what errors do you get? Maybe your problems are from the new security Drupal stuck in core for the last update (with 'tokens')?

Pobster

hba’s picture

Guestbook.module now supports anonymous guestbooks (and a lot more) in the newly submitted 4.7 module (DRUPAL-4-7 tag in CVS). Thanks to tenrapid for the rewrite.

http://drupal.org/project/guestbook