R – Drupal: add contact form as field to user profile

cmddrupaldrupal-6

Drupal allows you to create additional fields for user profile pages that can be publically accessible (anonymous user). I would like to add a contact form on each user´s profile page. I know that each user already has a contact page, but I want to have a contact form that´s embedded on the http://localhost/users/foobar page.

Maybe there is a module that adds a field type to profiles? Or maybe you can use a form creation module that also allows you to diplay the form on the user profile page?

I´m running Drupal 6.14 and i´m using these modules:

admin_menu        ctools  filefield   jquery_ui  pathauto          vcard
auto_nodetitle    date    imageapi    jump       taxonomy_manager  views
cck               devel   imagecache  link       token             webform
content_taxonomy  email   imagefield  panels     transliteration

Best Answer

In your theme, extend the default user-profile.tpl.php with the following code:

<?php 
print drupal_get_form('contact_mail_user', $account);
?>
Related Topic