Skip to content

Instantly share code, notes, and snippets.

@zachskaggs
Created September 29, 2014 19:33
Show Gist options
  • Save zachskaggs/f2f205db6b797fb2a300 to your computer and use it in GitHub Desktop.
Save zachskaggs/f2f205db6b797fb2a300 to your computer and use it in GitHub Desktop.
Ninja Forms PHP
<?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