It does not sound like you could use a conditional shortcode, since you always want to send two different notifications, correct?
I think I would use the regular admin notification email of {all_fields} for your full notification, and then use the gform_after_submission hook to send a simple email to your other address which would include just the phone number field. http://www.gravityhelp.com/documentation/page/Gform_after_submission
The function you write could be as simple as:
[php]
<?php
// change the 88 here to your form ID
add_action('gform_after_submission_88', 'email_phone_number', 10, 2);
function email_phone_number($entry, $form) {
// change the 5 here to the field ID where your phone number is stored
$phone = $entry['5'];
// set your second admin email address here
wp_mail('admin2@example.net', 'Phone Number from form submission', $phone);
}
You can get creative with the Subject line by including $entry details or $form details.
Documentation for wp_mail: http://codex.wordpress.org/Function_Reference/wp_mail
Posted 11 years ago on Wednesday January 23, 2013 |
Permalink