frm_to_email hook help
-
I have a function that programmatically displays an email and I want to pass it to the
function custom_set_email_value($recipients, $values, $form_id, $args)
and hook
add_filter('frm_to_email', 'custom_set_email_value', 10, 4);
but it is not working.add_filter('frm_to_email', 'custom_set_email_value', 10, 4); function custom_set_email_value($recipients, $values, $form_id, $args){ $recipients = array(); //Email 1 if($form_id == 2 && $args['email_key'] == 6806){ // change 5 to the id of your form and 4933 with the ID of the email $recipients[] = '[email protected]'; } //Email 2 if($form_id == 2 && $args['email_key'] == 6807){ // change 5 to the id of your form and 4933 with the ID of the email $recipients[] = 'b@bcom'; } //Email 3 if($form_id == 2 && $args['email_key'] == 6809){ // change 5 to the id of your form and 4933 with the ID of the email //working $recipients[] = strval(get_email1()) ; //not working $recipients[] = strval(get_email2()) ; } return $recipients; } //this is working function get_email1() { return '[email protected]'; } //not working function get_email2() { //neither below is working echo $generated_email; //return $generated_email; }Can the emails be passed to the function programmatically or must they be hard coded strings?
The topic ‘frm_to_email hook help’ is closed to new replies.