function subscriptions_form_alter in Subscriptions 5
Implementation of hook_form_alter().
File
- ./
subscriptions.module, line 906
Code
function subscriptions_form_alter($form_id, &$form) {
global $user;
$node = $form['#node'];
if ($user->uid && !$user->subscriptions_auto && isset($form['type']) && $form['type']['#value'] . '_node_form' == $form_id && $form['#node']->comment == COMMENT_NODE_READ_WRITE) {
$form['subscriptions'] = array(
'#type' => 'fieldset',
'#title' => t('Subscriptions'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => 1,
);
$allsubs = subscriptions_get_user();
$val = isset($node->subscriptions_subscribe) ? $node->subscriptions_subscribe : $allsubs['node'][$node->nid] ? 1 : $user->subscriptions_subscribe;
$form['subscriptions']['subscriptions_subscribe'] = array(
'#type' => 'checkbox',
'#title' => t('Subscribe'),
'#description' => t('Receive notification of replies or comments to this node.'),
'#default_value' => $val,
);
}
if (isset($node->status)) {
$form['subscriptions']['subscriptions_currentstatus'] = array(
'#type' => 'value',
'#value' => $node->status,
);
}
}