Created
September 29, 2014 19:33
-
-
Save zachskaggs/f2f205db6b797fb2a300 to your computer and use it in GitHub Desktop.
Ninja Forms PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_cool_filter( $setting, $setting_name, $id ) { | |
global $ninja_forms_processing; | |
// Bail if we aren't filtering the to setting | |
if ( 'to' != $setting_name ) | |
return $setting; | |
// Bail if our notification's setting name isn't admin_email | |
if ( 'admin_email' != Ninja_Forms()->notification( $id )->get_setting( 'name' ) ) | |
return $setting; | |
// Get our submitted field value | |
$value = $ninja_forms_processing->get_field_value( 3 ); | |
// Bail if our value isn't set or is false | |
if ( ! $value ) | |
return $setting; | |
switch ( $value ) { | |
case 'zach': | |
$setting[] = '[email protected]'; | |
break; | |
case 'kevin': | |
$setting[] = '[email protected]'; | |
break; | |
case 'james': | |
$setting[] = '[email protected]'; | |
break; | |
} | |
return $setting; | |
} | |
add_filter( 'filter__email_message', 'my_cool_filter', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment