diff --git a/comment_notify.inc b/comment_notify.inc index e82bdc9..474e011 100644 --- a/comment_notify.inc +++ b/comment_notify.inc @@ -136,7 +136,7 @@ function comment_notify_add_notification($cid, $notify, $notify_hash) { return (bool)db_insert('comment_notify') ->fields(array( 'cid' => $cid, - 'notify' => $notify, + 'notify' => $notify === NULL ? 0 : $notify, 'notify_hash' => $notify_hash, )) ->execute(); @@ -164,7 +164,7 @@ function comment_notify_remove_all_notifications($cid) { function comment_notify_update_notification($cid, $notify) { return (bool)db_update('comment_notify') ->fields(array( - 'notify' => $notify, + 'notify' => $notify === NULL ? 0 : $notify, )) ->condition('cid', $cid) ->execute(); diff --git a/comment_notify.module b/comment_notify.module index bbd7843..e13e25b 100644 --- a/comment_notify.module +++ b/comment_notify.module @@ -131,7 +131,7 @@ function comment_notify_form_comment_form_alter(&$form, &$form_state, $form_id) $form['notify_settings']['notify_type'] = array( '#type' => 'radios', '#options' => $available_options, - '#default_value' => $preference, + '#default_value' => $preference ? $preference : NULL, ); if (count($available_options) == 1) { $form['notify_settings']['notify_type']['#type'] = 'hidden';