Hi!
It’s definitely doable with some custom code. Here’s something I haven’t had the chance to test but should do what you want:
function email_content_all_fields( $content, $email, $form, $fields ) {
$output = '<table class="af-field-include">';
foreach ( $fields as $field ) {
if ( empty( $field['value'] ) ) {
continue;
}
if ( 'clone' == $field['type'] ) {
foreach ( $field['sub_fields'] as $sub_field ) {
$output .= sprintf( '<tr><th>%s</th></tr>', $sub_field['label'] );
$output .= sprintf( '<tr><td>%s</td></tr>', _af_render_field_include( $sub_field, $field['value'][ $sub_field['name'] ] ) );
}
} else {
$output .= sprintf( '<tr><th>%s</th></tr>', $field['label'] );
$output .= sprintf( '<tr><td>%s</td></tr>', _af_render_field_include( $field ) );
}
}
$output .= '</table>';
return $output;
}
add_filter( 'af/form/email/content/key=FORM_KEY', 'email_content_all_fields', 10, 4 );
It’s simply the code for {all_fields} but modified to check if the field value is empty first!
Hope that works!
Thread Starter
flipty
(@flipty)
Wow, even if this *does not* work I commend you on your excellent support! I will try it out and report back.
Haha, I hope it works now! Also, remember to replace FORM_KEY with your actual form key 🙂
Thread Starter
flipty
(@flipty)
That worked AMAZINGLY. Thank you!!