--- /Users/david/Downloads/whisper-dev/whisper.module 2009-01-10 14:12:36.000000000 -0500 +++ /Users/david/Desktop/whisper-patched.module 2009-01-10 13:31:21.000000000 -0500 @@ -47,6 +47,11 @@ function whisper_form_alter(&$form, $for // Add seal option to all comment forms and guestbook forms if ($form_id == "comment_form" || $guestbook) { + + // Get the node being commented on + $node = node_load($form['nid']['#value']); + $whisper_variable = 'whisper_'. str_replace(' ','_',$node->type); // Defaults to 'whisper_' if $node or $node->type is unset + if (user_is_anonymous()) { // Check for configuration setting whether to seal anonymous comments if (variable_get('whisper_anonymous', 1)) { @@ -57,6 +62,13 @@ function whisper_form_alter(&$form, $for ); } } + elseif (variable_get($whisper_variable,1)==0) { + // Set sealed to 1 (TRUE) if comments on this content type are automatically sealed + $form['sealed'] = array( + '#type' => 'value', + '#value' => 1, + ); + } else { // Get value from database when editing comment if ($form['cid']['#value']) { @@ -81,7 +93,17 @@ function whisper_form_alter(&$form, $for $form['#submit'][] = 'whisper_guestbook_submit'; } } - unset($guestbook); // Destroy variable + unset($guestbook,$whisper_variable); // Destroy variables + + // Add option to automatically seal nodes in content type administration page + if ($form_id == 'node_type_form' && isset($form['identity']['type'])) { + $form['comment']['whisper'] = array( + '#type' => 'radios', + '#title' => t('Automatically seal all comments for this content type'), + '#default_value' => variable_get('whisper_'. $form['identity']['type']['#default_value'],1), + '#options' => array(t('Seal comments automatically'), t('Do not seal comments automatically')), + ); + } }