It would be great if this module could add a default text to the BODY of the message being sent, the same way it does with subject.

This way one could easily add a link to any node - for example, a product page - like "request more information about this product". Then the contact form would automatically be filled with the name and/or link for that product page.

Comments

neclimdul’s picture

That's an interesting and useful idea. I'm not sure exactly how would be best to go about doing this yet. We could use the same passed variable idea but that would be fairly limited. Using a generic message as a setting and then passing a node might be useful but limited for linkings from non-node pages.

Feel free to play with this and post patches though. I'd love to review or work with you on something toward this goal.

dtabach’s picture

I'm glad you liked the idea. But I'm sad I cannot help with coding, as I'm not a programmer and my PHP knowledge is almost null (this did not prevent me from opening your module and naively trying to replace $subject by $body, without success...).

I would be glad to help testing the module, though.

The method you used in subjects is simple and efficient, IMHO. The text that would be passed to the body of the message would not be longer than one or two phrases, in most cases. So a simple variable would be fine.

Although it has its limitations, the feature this way would already be a good improvement in usage. So please consider adopting for the body the same technique you used in subjects, if this makes it easier to implement. Then leave the more comprehensive approach to a future version.

Thanks.

dtabach’s picture

The naive solution works! It was just a matter of replacing $subject not for $body, but for $message.

So, if you add

    if ($message = $_GET['message']) {
      $form['message']['#default_value'] = check_plain($_GET['message']);
    }

Just after the similar code for $subject, you'll have the new feature working.

neclimdul’s picture

Status: Active » Fixed

I was hesitant about this because in a way it encourages nasty urls. But, thinking about it more, I don't think that's a good reason to not have it.

In the interest of your users, don't put 10k character messages in the GET arguments...

Committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.