Using Gravity Forms ‘gform_addon_feed_settings_fields’ PHP filter

The gform_addon_feed_settings_fields filter allows you to modify the feed settings fields before they are rendered on the Feed Settings edit view in Gravity Forms.

Usage

To use the filter for all add-on feeds:

add_filter('gform_addon_feed_settings_fields', 'your_function_name', 10, 2);

To target a specific add-on:

add_filter('gform_{ADDON_SLUG}_feed_settings_fields', 'your_function_name', 10, 2);

Replace {ADDON_SLUG} with the slug of the add-on you want to target.

Parameters

  • $feed_settings_fields (array): An array of feed settings fields displayed on the Feed Settings edit view.
  • $addon (object): The current instance of the GFAddon object which extends GFFeedAddOn or GFPaymentAddOn.

More information

See Gravity Forms Docs: gform_addon_feed_settings_fields

The filter was added in Gravity Forms 2.0. The source code is located in GFFeedAddOn::get_feed_settings_fields() in /includes/addons/class-gf-feed-addon.php.

Examples

Add a Custom Setting to the First Section of All Feeds

Add a new custom setting to the first section of all add-on feeds:

add_filter('gform_addon_feed_settings_fields', 'add_custom_addon_setting', 10, 2);

function add_custom_addon_setting($feed_settings_fields, $addon) { $feed_settings_fields[0]['fields'][] = array( 'name' => 'my_custom_setting', 'label' => 'My Custom Setting', 'type' => 'text' );

return $feed_settings_fields;

}

Add a Custom Setting After “Send Email” Setting for All User Registration Feeds

Add a new setting after the “Send Email” setting for all User Registration feeds:

add_filter('gform_gravityformsuserregistration_feed_settings_fields', function($feed_settings_fields, $addon) {
    $feed_settings_fields = $addon->add_field_after('sendEmail', array(
        array(
            'name' => 'my_custom_setting',
            'label' => 'My Custom Setting',
            'type' => 'text'
        )
    ), $feed_settings_fields);
return $feed_settings_fields;

}, 10, 2);

Remove ‘Password’ Setting for User Registration Feeds for a Specific Form

Remove the ‘Password’ setting for User Registration feeds for a specific form:

add_filter('gform_gravityformsuserregistration_feed_settings_fields', function($feed_settings_fields, $addon) {
    $form = $addon->get_current_form();
    if ($form['id'] == 1) {
        $feed_settings_fields = $addon->remove_field('password', $feed_settings_fields);
    }
return $feed_settings_fields;

}, 10, 2);