gform_aweber_field_value

Description

This filter can be used to modify a value before it is sent to AWeber.

Usage

The base filter which would run for all forms and all fields would be used like so:

add_filter( 'gform_aweber_field_value', 'your_function_name', 10, 4 );

To target a specific form append the form id to the hook name. (format: gform_aweber_field_value_FORMID)

add_filter( 'gform_aweber_field_value_10', 'your_function_name', 10, 4 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_aweber_field_value_FORMID_FIELDID)

add_filter( 'gform_aweber_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

ParameterTypeDescription
$valuestringThe value to be modified.
$form_idintegerThe ID of the form being processed.
$field_idstringThe ID of the field being processed.
$entryEntry ObjectThe entry currently being processed.

Examples

1. Change Signature Value

This example shows how you can send the url of the signature image.

add_filter( 'gform_aweber_field_value', 'change_signature_value', 10, 4 );

function change_signature_value( $value, $form_id, $field_id, $entry ) {
    $form  = GFAPI::get_form( $form_id );
    $field = GFFormsModel::get_field( $form, $field_id );

    if ( is_object( $field ) && $field->get_input_type() == 'signature' ) {
        $value = RGFormsModel::get_upload_url_root() . 'signatures/' . $value;
    }

    return $value;
}

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

gf_apply_filters( 'gform_aweber_field_value', array( $form['id'], $field_id ), $field_value, $form['id'], $field_id, $entry );

This filter is located in GFAWeber::maybe_override_field_value() in class-gf-aweber.php.

Since

The base filter was added in version 2.0. The form and field specific versions of this filter were added in version 2.3.