Wordpress comment form contains a text field where visitors can enter a link to their website. Is there any module ( or simple way )to achieve the same thing in Drupal ?

What I'm really looking for is a solution that:

  • adds a new field to the comment form that needs to be validated as a link
  • when the comment is displayed , the username needs to link to the website entered in the form , not to the user profile as it does by default.

I would use the URL field module to create the website field on the comment entity. You can then use function theme_comment_submitted in your theme's preprocess functions to override the $submitted variable that is used in comment.tpl.php from the Drupal root folder /modules/comment/ (you can also copy this file into your theme's templates folder for further customization of the comment display).

The idea would be to alter function theme_comment_submitted (shown below) to include the username hyperlinked with an href provided by your URL field.

function theme_comment_submitted($comment) {
  return t('Submitted by !username on @datetime.', array(
    '!username' => theme('username', $comment),
    '@datetime' => format_date($comment->timestamp),

This is indeed very simple. You can add fields to the comment entity. Have a look at these explanations of how o achieve this:



  • Thank you for your answer, I think the question was not really well formulated so I added some more detail.
    – iacobs
    Aug 9 '14 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.