no preview button (how to enable the submit button instead)

chiefguest - November 8, 2007 - 21:31
Project:Usernode Guestbook
Version:5.x-1.x-dev
Component:User interface
Category:support request
Priority:critical
Assigned:MarcoR
Status:closed
Description

sorry to post this here, but i didnt thought any other place would be as relevant as this

I have installed usernode guestbook and nothing went wrong (no script errors) but when i check the user node or user profile i see fields to input the comments for user but i dont see a link for submit. I mean the submit text doesnt have the hyperlink its just the text. I do know what to do so am here submitting for your help.

thanks

#1

chiefguest - November 8, 2007 - 21:32

#2

chiefguest - November 8, 2007 - 21:32

#3

MarcoR - November 9, 2007 - 05:48
Title:no hyperlink on submit text» no preview button (how to enable the submit button instead)
Category:bug report» support request
Assigned to:Anonymous» MarcoR

Usernode guestbook uses the original comment buttons to post a guestbook entry like a comment. Due to some ugly nesting in preview mode (the preview is rendered like a comment and the comment itself is rendered inside of this again) I disabled the preview mode, because I currently see no well designed solution for this. Our Drupal gurus may know what to do here and I will change this as soon as I know.

Until then it is advised to let users submit comments without previewing. I suppose the problem is that you have set comment previewing to required. So here's my advice:

Recommended configuration

  1. Go to admin/content/comment/settings
  2. Set "Preview comment" to "Optional"

Please post if it helped you.

#4

MarcoR - November 9, 2007 - 08:56
Status:active» reviewed & tested by the community

Will be fixed in next dev version. Even if preview is required for comments usernode guestbook entries will have a submit button.
Preview is not possible yet due to a rendering problem. We need a more elegant solution for this instead of complete rewrite of the form.

Old or potentially new code is commented out.

<?php
/**
* Implementation of hook_form_alter to change appearence of comment_form
* especially for usernodes.
*
* @param string $form_id
*   name of the form
* @param array $form
*   editable form array by reference
*/
function usernode_guestbook_form_alter($form_id, &$form) {
  if (
$form_id == 'comment_form') {
   
$node = node_load(array('nid' => $form['nid']['#value']));
    if (
$node->type == 'usernode') {
      unset(
$form['subject']);
     
$form['comment_filter']['comment']['#rows'] = 3;
     
$form['comment_filter']['comment']['#title'] = t('Leave a message');
     
/*
      if (variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) {
        unset($form['preview']);
      }
      else {
        $op = isset($_POST['op']) ? $_POST['op'] : '';
        $form['preview']['#value'] = t('Preview');
        if ($op == t('Preview')) {
          $form['#after_build'] = array('comment_form_add_preview');
          $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
        }
      }
      */
      // Previewing is ugly because the form is rendered as a comment
      // and preview is rendered inside of this again. Always show submit button.
     
unset($form['preview']);
     
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
     
$form['#redirect'] = _usernode_guestbook_redirect($node->uid, 'comments');
    }
  }
}
?>

#5

MarcoR - November 9, 2007 - 20:48
Status:reviewed & tested by the community» fixed

committed into latest dev version.

#6

Anonymous - November 23, 2007 - 20:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.