Skip Navigation

[Résolu] How to replace to field in cred notification

This support ticket is created Il y a 6 années et 11 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 réponse, has 2 voix.

Last updated by Minesh Il y a 6 années et 11 mois.

Assisted by: Minesh.

Auteur
Publications
#524933

I am trying to:

send notification to dynamic email address with customer phone from the form. In example to 07905487@sms.clicksend.com. The number 07905487 (phone)must be taken from field (cust-phone) in the form submitted.

I visited this URL:

I've added this to functions

function customise_cred_notifications( $post_id, $headers, $formid, $postid, $notification_name, $notification_number ) {
if ($formid==2867 && $notification_number==2) {
$myheaders = array();
$myuser = get_post_meta($post_id, 'cust-phone', true);
$myheaders = array( 'CC: ' .$myuser. '@sms.clicksend.com' );
return array_merge($headers, $myheaders);
}
}
add_filter('cred_mail_header', 'customise_cred_notifications', 10, 5);

I expected to see:

value from cust-phone added to CC of the email.

Instead, I got:

Nothing - not even CC: @sms.clicksend.com. Email is just sent to wordpress user (Send notification to a WordPress user:) without CC.
If I replace ' .$myuser. '@sms.clicksend.com' with email address - CC is sent to this email. Please help.

#525126

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I believe field "cust-phone" is created using Types - correct? If yes: Types field uses prefix "wpcf-" for each custom field.

Could you please try to use following line of code:

function customise_cred_notifications( $post_id, $headers, $formid, $postid, $notification_name, $notification_number ) {
if ($formid==2867 && $notification_number==2) {
$myheaders = array();
$myuser = get_post_meta($post_id, 'wpcf-cust-phone', true);
$myheaders = array( 'CC: ' .$myuser. '@sms.clicksend.com' );
return array_merge($headers, $myheaders);
}
}
add_filter('cred_mail_header', 'customise_cred_notifications', 10, 5);
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.