You are here

function submitted_by_comment_submitted in Submitted By 6

Format the "Submitted by username on date/time" for each comment. varying the results by node type.

1 string reference to 'submitted_by_comment_submitted'
submitted_by_theme_registry_alter in ./submitted_by.module
An implementation of hook_theme_registry_alter()

File

./submitted_by.module, line 180
Take over the "Submitted by" theme function to allow different content types to have different strings.

Code

function submitted_by_comment_submitted($comment) {
  $type = db_result(db_query(db_rewrite_sql("SELECT n.type FROM {node} n WHERE n.nid=%d"), $comment->nid));
  if (variable_get('submitted_by_comment_' . $type, NULL)) {
    $submitted = variable_get('submitted_by_comment_' . $type, NULL);
  }
  else {
    $submitted = variable_get('submitted_by_comment_default', NULL);
  }
  if ($submitted) {
    return filter_xss_admin(token_replace($submitted, 'comment', $comment));
  }
  else {
    return t('Submitted by !username on @datetime', array(
      '!username' => theme('username', $comment),
      '@datetime' => format_date($comment->timestamp),
    ));
  }
}