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
| Parameter | Type | Description |
|---|---|---|
$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
Add the 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
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GFAWeber::export_feed() in class-gf-aweber.php.