Description
This filter can be used to modify the subscription parameters (arguments) before they are sent to AWeber.
Usage
The filter which would run for all AWeber feeds can be used like so:
add_filter( 'gform_aweber_args_pre_subscribe', 'your_function_name', 10, 4 );
You can limit the scope of the filter to a single form by appending the form id on the end of the hook name like so:
add_filter( 'gform_aweber_args_pre_subscribe_5', 'your_function_name', 10, 4 );
Parameters
- $args array
An associative array containing all the parameters to be passed to AWeber.
-
$form Form Object
The Form which is currently being processed.
-
$entry Entry Object
The Entry which is currently being processed.
-
$feed Feed Object
The Feed which is currently being processed.
Examples
1. Add ip_address Parameter
The following example shows how you can add the ip_address parameter.
add_filter( 'gform_aweber_args_pre_subscribe', function ( $args, $form, $entry, $feed ) { $args['ip_address'] = rgar( $entry, 'ip' ); return $args; }, 10, 4 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
apply_filters( "gform_aweber_args_pre_subscribe_{$form['id']}", apply_filters( 'gform_aweber_args_pre_subscribe', $params, $form, $entry, $feed ), $form, $entry, $feed )
This filter is located in GFAWeber::export_feed() in class-gf-aweber.php.