Hi,

I was wondering whether it is possible to display an Email contact form within a node page which contains Email field. Currently if an user wants to send an email he has to click a link "Email contact form" and then fill in a form. I would like to display the form without clicking the link "Email contact form".

I assume that is not currently possible. Therefore, I have created a new formatter. It is not fully functional. Is there anybody who would be interested in this function and help me out to finish the formatter?

Thanks, Martin.

Comments

MPeli’s picture

StatusFileSize
new6.86 KB
new13.28 KB

Hi,
the formatter is fully functional now. Is it worth implementing into the Email field module? Martin.

krem’s picture

Hi MPeli,

Thanks for your contribution, it corresponds exactly to what I need!
After installing the module I'm getting numerous warning messages like "MySQL server has gone away query ...". I can confirm that the contact form is displayed properly, and everything is fine on the front part, but in the admin interface the warning messages make it impossible to use...

I found that the language files still have mention of email.module, I'm using french language... Do you think it could cause those errors ? I even had a look to the module code and it seems pretty straight forward... don't know what can cause the errors... If you have any idea I'm up for it !

Thanks again,
Clem

krem’s picture

I want to add that I tested to simply copy/paste the content of email_email_form.module in my own custom module and everything works fine !!

krem’s picture

Actually I get back what I said before, I can't get it to work by copying the code in my custom module

MPeli’s picture

The language files included in my module should be deleted because they were copied from the email module. Try to do so and reinstall it. The module works fine for me. I get no errors. I am using Czech language...

The zip file should be unzipped into "/sites/all/modules" folder.

sumitshekhawat7331’s picture

Gud Job Man :)

jaskegreen’s picture

Does this work in v7?

Cheers

john_b’s picture

No. I would like this feature.

I have got it working by adding some of the code into my customized / hacked copy of the main module (as it was the easiest way). But the quality of my coding is pretty hacky, so I'm not posting it.

johnv’s picture

Does the following D7-patch help? #1264210: Add actual contact form display formatter

sunshinee’s picture

This works great in D6 with the translation files removed. However, the form shows up even when the email field is empty. This is only true with the field set to display the "better contact form," and doesn't happen using the other formatters. I'll take a look and try to see what is different, but I think this would be a fantastic addition to the module. Thanks for sharing!

sunshinee’s picture

Ok, this is probably not the sexiest method, but it works. Starting at line 35:

/**
 * Theme function for 'cform' email field formatter.
 */
function theme_email_email_form_formatter_cform($element) {
  $node = node_load(arg(1));
  $email = $element['#item']['email'];
  $recipient = $element['#item']['title'];
  $output = drupal_get_form('email_email_form_cform_page_form', $email, $node);
	
  return $output;
}

is changed to include a conditional check for the field to be set

/**
 * Theme function for 'cform' email field formatter.
 */
function theme_email_email_form_formatter_cform($element) {
if (!empty($element['#item']['safe'])){
  $node = node_load(arg(1));
  $email = $element['#item']['email'];
  $recipient = $element['#item']['title'];
  $output = drupal_get_form('email_email_form_cform_page_form', $email, $node);
	
  return $output;}
}

Hope this helps someone
Joy

nessunluogo’s picture

Issue summary: View changes

I know this is an old issue, but google shows as first result.

Anyone looking for a solution to this problem in D7 can simply use the Views Contact Form module, wich adds "A new formatter when used with the Email Field module to display the contact form."

Hope this helps.