array ( 'rules' => array ( 'rules_email_private_data_request' => array ( '#type' => 'rule', '#set' => 'event_webform_rules_submit', '#label' => 'Email Private Data Request', '#active' => 1, '#weight' => '0', '#categories' => array ( 0 => 'Data', ), '#status' => 'custom', '#conditions' => array ( 0 => array ( '#type' => 'condition', '#settings' => array ( 'selected_webform' => 'webform-client-form-10436', '#eval input' => array ( 'token_rules_input_evaluator' => array ( 'selected_webform' => array ( 0 => ':global', ), ), ), ), '#name' => 'webform_rules_condition_webform_id', '#info' => array ( 'label' => 'Select a webform', 'arguments' => array ( 'form_id' => array ( 'type' => 'value', 'label' => 'The form id of the submitted form', ), 'selected_webform' => array ( 'label' => 'Webform', 'type' => 'string', ), ), 'module' => 'Webform', ), '#weight' => 0, ), 1 => array ( '#info' => array ( 'label' => 'Execute custom PHP code', 'module' => 'PHP', 'eval input' => array ( 0 => 'code', ), ), '#name' => 'rules_condition_custom_php', '#settings' => array ( 'code' => ' if (!empty($data[components][referrer][value][0])){ return TRUE; } else { return FALSE;}', 'vars' => array ( 0 => 'data', ), '#eval input' => array ( 'token_rules_input_evaluator' => array ( 'code' => array ( 0 => ':global', ), ), ), ), '#type' => 'condition', '#weight' => 0, ), ), '#actions' => array ( 0 => array ( '#weight' => 0, '#type' => 'action', '#settings' => array ( 'code' => ' /*******************************************/ /*************Declare Variables************/ /*******************************************/ global $base_url; $data_nid = $data[components][referrer][value][0]; /*******************************************/ /*****Retrieve Contact and Data Set Information******/ /*******************************************/ //load data set $data_set = node_load($data_nid); //load person node(s) for contact field $contact = array(); foreach( $data_set->field_dataset_contact as $item) { $contact[] = node_load($item[nid]); } /*******************************************/ /***************Generate Email*****************/ /*******************************************/ // Send the email to... foreach($contact as $item){ if( !$to ) $to = $item->field_person_email[0][email]; else $to .= ", " . $item->field_person_email[0][email]; }; dpm($to); //Set the subject line $subject = "Data Set Requested from UMBS Research Gateway"; //generate message - one line at a time $message = "Dear UMBS Colleague,\\n\\n" ; $message .= "You are a contact for a data set downloaded from our Research Gateway. Here is a summary of the download. \\n\\n"; $message .= "Data Set Title: " . $data_set->title . "\\n"; $message .= "Data Set URL: " . $base_url . "/node/" . $data_set->nid . "\\n\\n"; $message .= "Requested by: " . [data:first_name-value] . " " . [data:last_name-value] . "\\n"; $message .= "Intended for publication: " . [data:dataset_use-value] . "\\n"; $message .= "Use description: " . [data:intended_use-display] . "\\n"; $message .= "Email: " . [data:email-display] . "\\n"; $message .= "Abide by UMBS Data Use Agreement: " . [data:data_agreement-value] . "\\n\\n"; $message .= "Please contact umbs-data@umich.edu if you have questions regarding this notification or would prefer not to receive notifications." . "\\n\\n"; dpm($message); //Compile the email and send $settings = array(); $settings[\'to\'] = $to; $settings[\'subject\'] = $subject; $settings[\'message\'] = $message; rules_action_mail($settings);', 'vars' => array ( 0 => 'data', ), '#eval input' => array ( 'token_rules_input_evaluator' => array ( 'code' => array ( 0 => 'data', 1 => ':global', ), ), ), ), '#name' => 'rules_action_custom_php', '#info' => array ( 'label' => 'Execute custom PHP code', 'module' => 'PHP', 'eval input' => array ( 0 => 'code', ), ), ), ), '#version' => 6003, ), ), )