Last active
September 10, 2016 23:59
-
-
Save helgatheviking/ccd97627280b41bac838 to your computer and use it in GitHub Desktop.
Ninja Forms AWeber Suppress certain errors
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
/* | |
* Submit form even if user is already subscribed to AWeber List | |
* | |
* @param $msg - current message from Ninja Forms for AWeber | |
* @param $error_message - original message from AWeber | |
* @param $error_code - null, placeholder for when AWeber gets error codes | |
* @param $subscriber - array of info about the subscriber submitted via form | |
* -- nb the form's ID can be found in $subscriber['form_id'] | |
* @param $list_id the list ID | |
*/ | |
function nf_aweber_ignore_specific_error( $show, $error_message, $error_code, $subscriber, $list_id ){ | |
if( strpos( $error_message, 'already subscribed' ) !== false ){ | |
$show = false; error_log('found error'); | |
} | |
return $show; | |
} | |
add_filter( "ninja_forms_aweber_show_errors", "nf_aweber_ignore_specific_error", 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment