Same name and namespace in other branches
  1. 5.x modules/forum/forum.module \forum_form_submit()
  2. 6.x modules/forum/forum.admin.inc \forum_form_submit()
  3. 7.x modules/forum/forum.admin.inc \forum_form_submit()

Process forum form and container form submissions.

File

modules/forum.module, line 520
Enable threaded discussions about general topics.

Code

function forum_form_submit($form_id, $form_values) {
  if ($form_id == 'forum_form_container') {
    $container = TRUE;
    $type = t('forum container');
  }
  else {
    $container = false;
    $type = t('forum');
  }
  $status = taxonomy_save_term($form_values);
  switch ($status) {
    case SAVED_NEW:
      if ($container) {
        $containers = variable_get('forum_containers', array());
        $containers[] = $form_values['tid'];
        variable_set('forum_containers', $containers);
      }
      drupal_set_message(t('Created new %type %term.', array(
        '%term' => theme('placeholder', $form_values['name']),
        '%type' => $type,
      )));
      break;
    case SAVED_UPDATED:
      drupal_set_message(t('The %type %term has been updated.', array(
        '%term' => theme('placeholder', $form_values['name']),
        '%type' => $type,
      )));
      break;
  }
  return 'admin/forum';
}