Hello,
I'm coming back to the previews ticket : https://toolset.com/forums/topic/placeholders-do-not-work-with-user-notification/
As mentioned, the placeholders in the notification mail do not work. I have checked and I have some code inside my function.php file related to placeholders (that I have created some times ago in order to use some specific fields in the notification). Do you think that this code that is currently running could explain that the standard Cred placeholders are not working (ie : perhaps the fact that I create new placeholder erase all the standard ones?).
Here is my code :
add_filter('cred_body_notification_codes', 'cb_wpcf_belongs_concours_id_placeholder', 999, 3);
function cb_wpcf_belongs_concours_id_placeholder($defaultPlaceHolders,$form_id,$post_id) {
if(($form_id == 13595) OR ($form_id == 13660) OR ($form_id == 13694) OR ($form_id == 5442) OR ($form_id == 7543) OR ($form_id == 13693) OR ($form_id == 5459) OR ($form_id == 29223) OR ($form_id == 29209) OR ($form_id == 13723) OR ($form_id == 32939) OR ($form_id == 13782) OR ($form_id == 36574) OR ($form_id == 13729) OR ($form_id == 36590) OR ($form_id == 13736) OR ($form_id == 36588) OR ($form_id == 38826) OR ($form_id == 38792) OR ($form_id == 29721) OR ($form_id == 29731) OR ($form_id == 38839) OR ($form_id == 40425) OR ($form_id == 35712)) {
$form_data_posted=get_post($post_id,ARRAY_A);
if (isset($form_data_posted)) {
$current_user = wp_get_current_user();
$concours_id = get_post_meta($post_id, '_wpcf_belongs_concours_id', true);
$chevaux_concours_id = get_post_meta($post_id, '_wpcf_belongs_chevaux-concours_id', true);
$cavaliers_concours_id = get_post_meta($post_id, '_wpcf_belongs_cavaliers-concours_id', true);
$confirmation_id = get_post_meta($post_id, '_wpcf_belongs_confirmation_id', true);
/*$tarifm_id = get_post_meta($post_id, '_wpcf_belongs_confirmation_id', true);*/
$auteur = $current_user->ID;
$auteur .= ' - ';
$auteur .= $current_user->user_firstname;
$auteur .= ' - ';
$auteur .= $current_user->user_lastname;
$auteur .= ' - ';
$auteur .= $current_user->user_email;
$concours = get_the_title($concours_id);
$confirmation = get_the_title($confirmation_id);
$chevaux_concours = get_the_title($chevaux_concours_id);
$cavaliers_concours = get_the_title($cavaliers_concours_id);
$prenom_cavaliers_concours = get_post_meta($cavaliers_concours_id, 'wpcf-ca-prenom-du-cavalier', true);
return array_merge($defaultPlaceHolders, array(
'%%champauteur%%' => $auteur,
'%%champconcours%%' => $concours,
'%%champconfirmation%%' => $confirmation,
'%%champcheval%%' => $chevaux_concours,
'%%champcavalier%%' => $cavaliers_concours,
'%%champprenomcavalier%%' => $prenom_cavaliers_concours
));
}
}
}
Regards
Pat