Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
What file do I change the contents of the email that is sent to the admin when a new comment has been posted to the site? I don't see anything in the comments_form.html for generating the contents of the sent email and can't find a file that handles that.

Thanks,
Hi Steve,

If you see the docs on comments http://www.couchcms.com/docs/concepts/u ... ments.html, you'll find the following highlighted statement in the success condition -
<cms:if k_process_comment_success>
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
<cms:show k_success />
</cms:send_mail>

Sending mail simply entails using the cms:send_mail tag with the message of your choice, as shown above. You can tweak it to suit you.

Hope this helps.
This is probably a really silly question but...

How do I change the labels on the info contained in the message? Here is the email that is received:

The following comment has been posted at your site:
k_author: Steve Lack
k_email: xxx@xxxx.xxx
k_comment: This is another comment.
captcha: 9stb

I would like to change the k_author to Name:, k_email to Email, etc. And I would like to remove the Captcha from the email notification.

In the file comments_form.html the only editable text I see is the "The following comment has been posted at your site:" line. Where do I edit the labels for the additional information that is included when the <cms: sendmail> is invoked?

Thanks,
Hi Steve,

I think you'll find the answer in this reply of mine - viewtopic.php?p=15485#p15485

Hope it helps. Please let me know.
I'm still not getting it. I understand that I can create a custom error message by using the method you posted. However, if I just want to change the labels that are sent in the email I'm not clear on where these labels are being generated from for the email.

Here's my comments_form.html file
<code>
<cms:if k_success >

<cms:process_comment />

<cms:if k_process_comment_success>
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
<cms:show k_success />
</cms:send_mail>

</code>

Once the comment is processed the email is sent to the send_mail from with the subject "Comment posted'. In the email body is printed "The following comment has been posted at your site:" and then is should "show k_success", but where in the file is k_success defined? If k_success is what is being placed in the email after the text "The following comment has been posted at your site:" how can I modify what comes after that text? I would like to have the labels read Name, Email, etc. but there isn't any obvious way to change k_author to Name: and k_email to Email: , etc.

Thanks,
Hi Steve,

I see that you are getting confused by the way forms are processed by Couch.

If you take a look the docs at http://www.couchcms.com/docs/concepts/forms.html, you'll find that whenever a Couch managed form is submitted, Couch flags the success condition by setting the 'k_success' variable which contains the submitted values of all fields concatenated together in a single string.

Additionally, it also makes available the submitted values of each field dicretely as variables that have 'frm_' prepended to the field names. e.g. if 'email' and 'name' are two fields, their values are available as 'frm_email' and 'frm_name'.

This gives us a choice to either use the single k_success variable or cherrypick each individual fields.
You have been using k_success so far.
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
<cms:show k_success />
</cms:send_mail>


If you make the code as follows, you can use individual values to craft the kind of message you want -
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
Name: <cms:show frm_k_author />
Email: <cms:show frm_k_email />
Comment: <cms:show frm_k_comment />
</cms:send_mail>

Point to note in the code above is that the names of the fields always used in the comment form are 'k_author', 'k_email', 'k_comment' and so these can be accessed (by prepending 'frm_' to the names) as 'frm_k_author', 'frm_k_email', 'frm_k_comment'.

Hope this helps.
That was it! Thanks again for the amazing support.
7 posts Page 1 of 1