function _plus1_forums_form_submit in Plus 1 6.2
1 string reference to '_plus1_forums_form_submit'
- plus1_forums_form_alter in ./
plus1_forums.module - Implements hook_form_alter(). Add individual node vote disabling.
File
- ./
plus1_forums.module, line 88 - Limit which forums allow voting.
Code
function _plus1_forums_form_submit($form, &$form_state) {
if (isset($form_state['values']['tid'])) {
$tid = $form_state['values']['tid'];
}
else {
drupal_set_message(t('Incomplete data for forum "@name".', array(
'@name' => $form_state['values']['name'],
)), 'error');
return;
}
// Get the current list of enabled forums.
$forums = variable_get('plus1_forums', array());
// Did they enable voting?
if ($form_state['values']['plus1_enable']) {
// Add this forum tid to the list, if it's new.
if (!in_array($tid, $forums)) {
$forums[] = $tid;
variable_set('plus1_forums', $forums);
}
}
else {
// They disabled voting so remove the tid from the list.
$key = array_search($tid, $forums);
if ($key !== FALSE) {
unset($forums[$key]);
variable_set('plus1_forums', $forums);
}
}
}