Use the Smart Grid extension for CF7, it introduces mail tag filters, so you would do something like,
add_filter( 'cf7sg_mailtag_my-checkbox', 'filter_cf7_mailtag_my_checkbox', 10, 3);
function filter_cf7_mailtag_select_option($tag_replace, $submitted, $cf7_key){
/*the $tag_replace string to change*/
/*the $submitted an array containing all submitted fields*/
/*the $cf7_key is a unique string key to identify your form, which you can find in your form table in the dashboard.*/
if('my-form'==$cf7_key ){
$tag_replace = '<ul>'.PHP_EOL;
foreach($submitted['my-checkbox'] as $value){
$tag_replace .= "<li>{$value}</li>".PHP_EOL;
}
$tag_replace .= '</ul>';
}
return $tag_replace;
}
The filter is customised for each mail tag, in this example I have a checkbox field called my-checkbox
, the plugin create the custom filter and helper code.
Please view this video tutorial to understand how to obtain the appropirate filter.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…