Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://www.gravityhelp.com/forums/topic/help-with-conditional-routing
- // change the 53 here to your form ID
- add_filter('gform_pre_submission_filter_53', 'add_bcc');
- function add_bcc($form){
- // the array indexes here are the values of the input select boxes. View source of the form to see the actual IDs
- $addresses = array(
- );
- // my form uses input_1 for the select box. Your form may be different. Change it here is necessary
- $input_prefix = 'input_1_';
- // clear out any BCC notifications from the form builder
- $bcc = '';
- // loop through 30 fields to see if we need to send more notifications
- for ($i=1; $i<=30; $i++) {
- // be careful: Gravity Forms avoids numbering inputs with numbers ending in zero
- $input_field = $input_prefix . $i;
- // Check the form submission for the select box. If there is a value in $input_field, then add the addresses for that selection to the bcc list
- // rgpost is a safe way of accessing the $_POST values
- if (rgpost($input_field)) {
- $bcc .= $addresses[$i] . ','; // we'll strip off this last comma later
- }
- }
- // remove the trailing comma is there is one
- $form['notification']['bcc'] = rtrim($bcc, ',');
- // return the modified form object
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement