function modr8_form_submit in modr8 5
Same name and namespace in other branches
- 6 modr8_admin.inc \modr8_form_submit()
- 7 modr8_admin.inc \modr8_form_submit()
Form submit handler, which approves or deletes the node.
File
- ./
modr8_admin.inc, line 239
Code
function modr8_form_submit($form_id, $form_values) {
foreach ($form_values as $nid => $values) {
$message = '';
switch ($values['ops']) {
case 'approve':
if (variable_get('modr8_send_approve', FALSE)) {
$message = modr8_usermail('approve', $nid, $values);
}
$node = node_load($nid);
if (user_access('administer nodes')) {
$node->status = 1;
}
$node->moderate = 0;
node_save($node);
drupal_set_message(t('The %type with title %title has been approved.', array(
'%title' => $values['title'],
'%type' => $values['type'],
)));
modr8_log_action('approve', $nid, $values, $message);
break;
case 'delete':
if (variable_get('modr8_send_deny', FALSE)) {
$message = modr8_usermail('deny', $nid, $values);
}
node_delete($nid);
// drupal does its own message
modr8_log_action('delete', $nid, $values, $message);
break;
case 'nada':
if (variable_get('modr8_send_noact', FALSE) && !empty($values['note'])) {
$message = modr8_usermail('nada', $nid, $values);
modr8_log_action('nada', $nid, $values, $message);
}
}
}
}