diff --git a/comment_notify.module b/comment_notify.module index 8107847..48b258b 100644 --- a/comment_notify.module +++ b/comment_notify.module @@ -143,9 +143,8 @@ function comment_notify_form_comment_form_alter(&$form, &$form_state, $form_id) // If this is an existing comment we set the default value based on their selection last time. if ($form['cid']['#value'] != '') { - module_load_include('inc', 'comment_notify', 'comment_notify'); $notify = comment_notify_get_notification_type($form['cid']['#value']); - $form['notify_settings']['notify']['#default_value'] = $notify; + $form['notify_settings']['notify']['#default_value'] = (bool) $notify; if (count($available_options) > 1) { $form['notify_settings']['notify_type']['#default_value'] = $notify; } @@ -247,9 +246,16 @@ function comment_notify_comment_publish($comment) { function comment_notify_comment_update($comment) { module_load_include('inc', 'comment_notify', 'comment_notify'); + // Take the status of the "notify" checkbox if they unchecked it. + if (empty($comment->notify)) { + $status = $comment->notify; + } + else { + $status = $comment->notify_type; + } // In case they have changed their status, save it in the database. - if (isset($comment->notify_type)) { - comment_notify_update_notification($comment->cid, $comment->notify_type); + if (isset($status)) { + comment_notify_update_notification($comment->cid, $status); } // And send notifications - the real purpose of the module. if ($comment->status == COMMENT_PUBLISHED) { @@ -603,7 +609,7 @@ function comment_notify_settings() { if (isset($enabled_types[$type]) && $enabled_types[$type] && variable_get('comment_anonymous_' . $type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAYNOT_CONTACT) { $account = drupal_anonymous_user(); if (user_access('subscribe to comments', $account)) { - $anonymous_problems[] = l(t('@content-type', array('@content-type' => $name)), 'admin/structure/types/manage/'. $type); + $anonymous_problems[] = l(t('@content-type', array('@content-type' => $name)), 'admin/structure/types/manage/' . $type); } } }