Commit 0a040e75 authored by greggles's avatar greggles

bug by neochief and greggles: Illegal choice 0 in notify_type element

parent 73e89ada
......@@ -90,16 +90,10 @@ function comment_notify_form_alter(&$form, &$form_state, $form_id) {
);
$options = variable_get('comment_notify_available_alerts', array(COMMENT_NOTIFY_NODE, COMMENT_NOTIFY_COMMENT));
foreach ($options as $key => $available) {
if ($key = $available) {
if ($key == $available) {
$available_options[$available] = $total_options[$available];
}
}
if (count($available_options) > 1) {
$options_type = 'radios';
}
else {
$options_type = 'hidden';
}
// Add the checkbox for anonymous users and set the default based on admin settings.
if ($user->uid == 0) {
......@@ -121,11 +115,18 @@ function comment_notify_form_alter(&$form, &$form_state, $form_id) {
'#default_value' => $preference,
);
$form['notify_type'] = array(
'#type' => $options_type,
'#default_value' => $preference,
'#options' => $available_options,
);
if (count($available_options) > 1) {
$form['notify_type'] = array(
'#type' => 'radios',
'#options' => $available_options,
);
}
else {
$form['notify_type'] = array(
'#type' => 'hidden',
);
}
$form['notify_type']['#default_value'] = $preference;
// If this is an existing comment we set the default value based on their selection last time.
if ($form['cid']['#value'] != '') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment