function comments_comment_form_submit

7.x comments.module comments_comment_form_submit($form, $form_state)
6.x comments.module comments_comment_form_submit($form, $form_state)
4.x comments.module comments_comment_form_submit($form, $form_state)
5.x comments.module comments_comment_form_submit($form, $form_state)

File

modules/comments/comments.module, line 133

Code

function comments_comment_form_submit($form, $form_state) {
  global $user, $current_student_id;
  $faculty_cwid = $user->cwid;
  $type = $form_state ["values"]["type"];
  $term_id = $form_state ["values"]["term_id"];
  $comment = trim($form_state ["values"]["comment"]);

  // Perform the save!
  if ($comment) {
    db_query("INSERT INTO advising_comments
              (student_id, faculty_id, term_id,
                comment, posted, access_type)
                VALUES
                ('?', '?', '?', '?', '?', '?')
                ", $current_student_id, $faculty_cwid, $term_id, $comment, time(), $type);

    fp_add_message(t("Comment saved successfully."));
  }

  watchdog("save_comment", "Comment saved");

}