Open Hube2 opened 9 years ago
I have looked into doing this and am having difficulty figuring out how. Mostly do to the poor documentation of CF7.
If anyone would like to take a look at this and suggest how it can be done or add it to the code and do a pull request....
Please see my comment here about the difficulties with adding this feature https://wordpress.org/support/topic/label-instead-of-value-in-mail?replies=3#post-7930669
Like I said here and there, if anyone can work out how this is done in CF7. The filters and hooks available in CF7 are not well documented.
Hi Hube2, I think you're looking for the filter wpcf7_posted_data. I've used it for changing post ID's to readable post titles in the sending e-mail. Hope it helps.
function modify_wpcf7_posted_data($items)
{
$tag = 'myselecttag';
// do nothing if we have nothing
if (!isset($items[$tag])) return $items;
// $items['tag'] is array of ID's or single ID
if (!is_array($items[$tag])) $items[$tag] = array($items[$tag]);
$ps = get_posts(array('post__in'=>$items[$tag]));
$items[$tag] = '';
foreach($ps as $p) $items[$tag] .= $p->post_title."\r\n";
return $items;
}
add_filter('wpcf7_posted_data', 'modify_wpcf7_posted_data',10,2);
From this topic on support forum https://wordpress.org/support/topic/label-instead-of-value-in-mail?replies=3