Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active September 10, 2016 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helgatheviking/ccd97627280b41bac838 to your computer and use it in GitHub Desktop.
Save helgatheviking/ccd97627280b41bac838 to your computer and use it in GitHub Desktop.
Ninja Forms AWeber Suppress certain errors
/*
* 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