You are here

function comment_sort_created_comment_insert in Comment sort by created 7

Implements hook_comment_insert().

Creates an entry in the comment_sort_created table after a comment has been created.

File

./comment_sort_created.module, line 76
Sorts comments by creation date.

Code

function comment_sort_created_comment_insert($comment) {

  // Generate a thread string based upon the creation date.
  $created_thread = comment_sort_created_get_timestamp_thread($comment);

  // Write new entry to table.
  $record = array(
    'cid' => $comment->cid,
    'created_thread' => $created_thread,
  );
  drupal_write_record('comment_sort_created', $record);
}