Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active March 4, 2016 16:36
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/29a862984f02bc7ae6a6 to your computer and use it in GitHub Desktop.
Save helgatheviking/29a862984f02bc7ae6a6 to your computer and use it in GitHub Desktop.
Ninja Forms AWeber Suppress all errors: Ninja Forms AWeber 1.3.1 is required for this to work
/*
* Suppress ALL AWeber errors and submit form
*/
add_filter( 'ninja_forms_aweber_show_errors', '__return_false' );
/*
* Suppress ALL AWeber errors on form id=5 and submit form
*
* @param $msg - current message from Ninja Forms for AWeber
* @param $error_code - null, placeholder for when AWeber gets error codes
* @param $error_message - original message from AWeber
* @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_suppress_errors_for_form( $show, $error_message, $error_code, $subscriber, $list_id ){
if( isset( $subscriber['form_id'] ) && 5 == intval( $subscriber['form_id'] ) ){
$show = false;
}
return $show;
}
add_filter( 'ninja_forms_aweber_show_errors', 'nf_aweber_suppress_errors_for_form', 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment