Hello,
I'm hoping to be able to accept photo uploads on comment submissions. I've got that part working using the extended comments and a data bound form (for the securefile image upload). Now I want to send an email to the site admin to notify them that a comment has been posted. I want to include the uploaded file in this email so that the admin can make a quick decision to approve the comment or reject it.
Right now the email sends fine, I just can't include the securefile image.
When I do a <cms:dump/> for the variables that are available right after the form has submitted, I can see the securefile input (frm_photo), but when I try to put the image link into an email, it doesn't work.
Comment Submission Processing Code
Extended Comment / DataBound Form
Any guidance that could be provided would be greatly appreciated!
I'm hoping to be able to accept photo uploads on comment submissions. I've got that part working using the extended comments and a data bound form (for the securefile image upload). Now I want to send an email to the site admin to notify them that a comment has been posted. I want to include the uploaded file in this email so that the admin can make a quick decision to approve the comment or reject it.
Right now the email sends fine, I just can't include the securefile image.
When I do a <cms:dump/> for the variables that are available right after the form has submitted, I can see the securefile input (frm_photo), but when I try to put the image link into an email, it doesn't work.
- Code: Select all
k_cur_form: kformname0
k_cur_form_method: post
k_cur_form_separator: |
k_cur_form_mode: create
k_submitted: 1
frm_k_author: Maiden Voyage
frm_k_email: hello@yourmaidenvoyage.com
frm_relationship:
frm_k_comment: test
frm_photo: 1
frm_recaptcha_test:
k_success: k_author: Maiden Voyage k_email: hello@yourmaidenvoyage.com relationship: k_comment: test Comment Photo: 1 recaptcha_test:
k_process_comment_success: 1
k_process_comment_error: 0
Comment Submission Processing Code
- Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='New Comment' html='1'>
<img src="<cms:show k_site_link/>img/logo.png" alt="App logo" width="350" />
<h1>New Comment Posted</h1>
<p>A new comment has been posted and needs to be reviewed.</p>
<p><strong>Name: </strong><cms:show frm_k_author /></p>
<p><strong>Email: </strong><cms:show frm_k_email /></p>
<p><strong>Relationship: </strong><cms:show frm_relationship /></p>
<p><strong>Comment: </strong></p>
<p><cms:show frm_k_comment /></p><br>
<cms:show_securefile 'frm_photo'>
<cms:if file_is_image>
<p><strong>Image Upload</strong></p>
<img src="<cms:cloak_url link=file_id thumbnail='1' />" />
</cms:if>
</cms:show_securefile>
<p><strong>Approval Link: </strong></p>
<a href="<cms:show k_admin_link />?o=comments&q=list&status=0"><cms:show k_admin_link />?o=comments&q=list&status=0</a>
</cms:send_mail>
Extended Comment / DataBound Form
- Code: Select all
<?php require_once( 'admin/cms.php' ); ?>
<cms:template title='Stop Comments' clonable='1' hidden='1'>
<cms:editable name='relationship' label='Relationship to Place' order='1' type='text' />
<cms:editable
name='photo'
label='Comment Photo'
allowed_ext='png, jpg, jpeg, tiff'
max_size='2048'
max_width='10000'
max_height='10000'
width='400'
height='400'
type='securefile'
thumb_width='100'
show_preview='1'
use_thumb_for_preview='1' />
</cms:template>
<?php COUCH::invoke(); ?>
Any guidance that could be provided would be greatly appreciated!