You are here

function anonymous_publishing_cl_admin_moderation_submit in Anonymous Publishing 7

Submit for the anonymous_publishing_admin_moderation form.

File

modules/cl/anonymous_publishing_cl.admin.inc, line 285
Menu callbacks for the CL tabs on the module admin page.

Code

function anonymous_publishing_cl_admin_moderation_submit($form, &$form_state) {
  if (!array_key_exists('ap_row', $form_state['values'])) {
    drupal_set_message(t('No nodes.'), 'error');
    return;
  }
  foreach ($form_state['values']['ap_row'] as $settings) {
    if ($settings['cid']) {
      $comm = comment_load($settings['cid']);
      if ($comm) {
        $comm->status = $settings['status'];
        comment_save($comm);
      }
    }
    else {
      $node = node_load($settings['nid']);
      if ($node) {
        $node->status = $settings['status'];
        node_save($node);
      }
    }
  }
  drupal_set_message(t('Revised published status saved.'));
}