gform_other_choice_value

gform_other_choice_value

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description

Use this filter to change the default 「Other」 text on Radio Button fields.

Usage

add_filter( 'gform_other_choice_value', 'set_placeholder', 10, 2 );

Parameters

$placeholder string
The placeholder to be filtered. Defaults to 「Other」.

$field null
Null or the Field currently being prepared for display or being validated.

Examples

This example changes the placeholder text to 「Enter your own value」 for all fields.

add_filter( 'gform_other_choice_value', 'set_placeholder', 10, 2 );
function set_placeholder( $placeholder, $field ) {
return 'Enter your own value';
}

This example changes the placeholder text to 「My Custom Text」 only for a field with id 6 that is added to a form that has id 25.

add_filter( 'gform_other_choice_value', 'set_placeholder', 10, 2 );
function set_placeholder( $placeholder, $field ) {
if ( is_object( $field ) && 6 === $field->id && 25 === $field->formId ){ // 6 and 25 to your field id and form id number.
$placeholder = 'My Custom Text';
}
return $placeholder;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

The $field parameter was added in 2.1.1.6.

Source Code

This filter is located in GFCommon::get_other_choice_value() in common.php.

gform_order_summary

gform_order_summary

DescriptionUsageParametersExamplesAdd a Row to the Order Summary Table FooterChange background color for the 『Order』 rowPlacementSinceSource Code

Description
The 「gform_order_summary」 filter in Gravity Forms filters the markup of the order summary which appears on the Entry Detail, the {all_fields} merge tag and the {pricing_fields} merge tag.
Usage
The base filter which would run for all forms and fields can be used like so:
add_filter( 'gform_order_summary', 'your_function_name', 10, 5 );

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_order_summary_6', 'your_function_name', 10, 5 );

Parameters

$markup string
The order summary markup.

$form Form Object
The current form.

$entry Entry Object
The current entry.

$order_summary array
An array containing the products, options and shipping for the current entry.

$format string
The format with which the markup should be formatted. Accepted values are 『html』 or 『text』.

Examples
Add a Row to the Order Summary Table Footer
Note that the markup differs slightly depending on the location the filter is called. When generated for the {all_fields} and {pricing_fields} merge tags, inline styles are included. When called from the Entry Detail view, inline styles are not included.
We recommend using GFCommon::is_entry_detail() to check if you are on the Entry Detail view. Otherwise, assume the generated markup is for one of the merge tags.
add_filter( 'gform_order_summary', function( $markup ) {
if( GFCommon::is_entry_detail() ) {
$row = '

  My Custom Option $10.00

';
} else {
$row = '

  My Custom Option $10.00

';
}

return str_replace( '

', '

' . $row, $markup );
} );

Change background color for the 『Order』 row
The following example will simply change the background color for the 『Order』 row from default color to red. Change FF0000 to any hexadecimal color value of your choice.
add_filter( 'gform_order_summary', function( $markup ) {
GFCommon::log_debug( __METHOD__ . '(): running.' );
// Change background color for the 'Order' row to FF0000 (red).
$markup = str_replace( 'EAF2FA', 'FF0000', $markup );
return $markup;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Since
Added in Gravity Forms 2.1.2.5.
Source Code
This filter is located in:

GFCommon::get_submitted_pricing_fields() in common.php
GFEntryDetail::lead_detail_grid() in entry_detail.php

gform_order_label

gform_order_label

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_order_label」 filter in Gravity Forms is executed when displaying the 「Order」 heading on the entry detail page or when sending the order information via email.
Usage
Applies to all forms
1add_filter( 'gform_order_label', 'change_order_label', 10, 2 );
Applies to a specific form. In this case, form Id 5
1add_filter( 'gform_order_label_5', 'change_order_label', 10, 2 );
Parameters

$label string
The label to be filtered.

$form_id integer
The current form』s id.

Examples
This example changes the default Order label to Estimate;
1234add_filter( 'gform_order_label', 'change_order_label', 10, 2 );function change_order_label( $label, $form_id ) {    return 'Estimate';}
Source Code
This filter is located in the following methods:

GFCommon::get_submitted_pricing_fields() in common.php
GFEntryDetail::lead_detail_grid() in entry_detail.php

gform_notification_validation (deprecated)

gform_notification_validation (deprecated)

DescriptionUsageParametersExamples1. Require a settingSinceSource Code

This filter was removed in Gravity Forms v2.5 and is no longer supported. From Gravity Forms 2.5, notification settings and their validation callbacks are now defined via the gform_notification_settings_fields filter.

Description

The gform_notification_validation filter can be used to validate custom notification settings added using the gform_notification_ui_settings and gform_pre_notification_save filters and override the default validation result.

Usage

The following would apply to all forms.

add_filter( 'gform_notification_validation', 'your_function_name', 10, 3 );

To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_notification_validation_FORMID)

add_filter( 'gform_notification_validation_5', 'your_function_name', 10, 3 );

Parameters

$is_valid boolean
The result of the default notification validation which checks if the emails for the to, bcc, and replyTo settings are valid.

$notification array
An array of properties which make up the notification object to be saved. See Notifications Object for default properties.

$form Form Object
The current form object to which the notification being saved belongs.

Examples

1. Require a setting

This example shows how the new setting added by the gform_notification_ui_settings and gform_pre_notification_save filters can be required.

add_filter( 'gform_notification_validation', 'notification_validation', 10, 3 );
function notification_validation( $is_valid, $notification, $form ) {

if ( rgempty( 'my_custom_setting', $notification ) ) {
$is_valid = false;
GFCommon::add_error_message( esc_html( 'Please enter a value for the My Custom Label setting.' ) );
}

return $is_valid;
}

Since

This filter was added in Gravity Forms 1.9.16.

Source Code

This filter is located in GFNotification::notification_edit_page() in notification.php

gform_notification_ui_settings

gform_notification_ui_settings

DescriptionUsageParametersExamplesAdd a new settingRemove existing settingSource Code

Description
Add new or modify existing notification settings that display on the Notification Edit screen.
Usage
The following would apply to all forms.
1add_filter( 'gform_notification_ui_settings', 'your_function_name', 10, 3 );
To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_notification_ui_settings_FORMID)
1add_filter( 'gform_notification_ui_settings_5', 'your_function_name', 10, 3 );

Parameters

$ui_settings array
An array of settings for the notification UI. Each setting contains the HTML which will be displayed for that setting.

$confirmation array
An array of properties which make up the current notification object to be edited. See Notifications Object for default properties.

$form Form Object
The current form object to which the notification being edited belongs.

Examples
Add a new setting
This example demonstrates how you can add a custom notification UI setting. Use with the gform_pre_notification_save hook to add the submitted value of your setting to the notification object. Use with the gform_notification_validation hook to ensure the value submitted for your setting is valid.
1234567891011add_filter( 'gform_notification_ui_settings', 'my_custom_notification_setting', 10, 3 );function my_custom_notification_setting( $ui_settings, $notification, $form ) {     $ui_settings['my_custom_setting'] = '        

            

            

        

';     return $ui_settings;}
Remove existing setting
The following example shows how to remove the From Email setting.
123456add_filter( 'gform_notification_ui_settings', 'remove_from_email_from_settings', 10, 3 ); function remove_from_email_from_settings( $ui_settings, $notification, $form ) {    unset ( $ui_settings['notification_from'] );    return $ui_settings;}
Source Code
This filter is located in GFNotification::get_notification_ui_settings() in notification.php

gform_notification_settings_fields

gform_notification_settings_fields

DescriptionUsageParametersExamplesAdd a new fieldPlacementSinceSource Code

Description

The gform_notification_settings_fields filter is used to customize the available settings on the Notification configuration page.

Usage

The filter which runs for all would be used like so:

add_filter( 'gform_notification_settings_fields', 'your_function_name', 10, 3 );

You can also target a specific form by adding the form id after the hook name.

add_filter( 'gform_notification_settings_fields_6', 'your_function_name', 10, 3 );

Parameters

$fields array
The Form Settings fields. See the Settings API for details about how the fields are defined.

$notification Notification Object
The meta for the form notification being viewed/edited.

$form Form Object
The current form.

Examples

Add a new field

This example would add a hidden field to the notification configuration page.

add_filter( 'gform_notification_settings_fields', function ( $fields, $notification, $form ) {
$fields[0]['fields'][] = array( 'type' => 'hidden', 'name' => 'my_custom_hidden_field' );

return $fields;
}, 10, 3 );

Placement

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFNotification::settings_fields() in notification.php.

gform_notification_services

gform_notification_services

DescriptionUsageParametersExamples1. Add a new servicePlacementSource Code

Description
The gform_notification_services filter can be used to add a new choice to the 「Email Service」 setting on the edit notification page.
Additional code is necessary to handle having the service actually send the notification email since this hook only makes the choice available to the user for selection when configuring their notifications.
Usage
The following would apply to all forms.
1add_filter( 'gform_notification_services', 'your_function_name', 10, 2 );

Parameters

$services array
An array of notification services.
123456$services = array(    'wordpress' => array(        'label' => esc_html__( 'WordPress', 'gravityforms' ),        'image' => admin_url( 'images/wordpress-logo.svg' )    ));

$form Form Object
The current Form object.

Examples
1. Add a new service
123456789add_filter( 'gform_notification_services', 'add_notification_service' );function add_notification_service( $services ) {    $services['the_service_name'] = array(        'label' => esc_html__( 'Your Custom Service', 'gravityforms' ),        'image' => 'http://someurl.com/image.svg'    );     return $services;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This action hook is located in GFNotification::get_notification_services() in notification.php

gform_notification_note

gform_notification_note

DescriptionParametersExamplesCustomize the result note with custom textDisable all notesDisable notes for specific notificationPlacementSinceSource Code

Description
Use this filter to modify the note(s) being added to the entry detail page that contain the sending result of notifications for the entry.
Parameters

$note_args array
Array containing text, type and subtype for the note.

$entry_id int
Id number for entry being processed.

$result bool
The result returned by wp_mail().

$notification array
The notification properties. See Notifications Object for possible properties.

$error_info string
Additional details for notifications with error.

$email array
Array containing email details.

Examples
Customize the result note with custom text
add_filter( 'gform_notification_note', 'custom_sending_result_note', 10, 6 );
function custom_sending_result_note( $note_args, $entry_id, $result, $notification, $error_info, $email ) {
if ( $result === true ){
$result_note['text'] = "Amazing! WordPress sent the email to: " . $email['to'];
}
return $result_note;
}

Disable all notes
The following example will prevent notes from being added to the entry for all notifications.
add_filter( 'gform_notification_note', '__return_empty_array' );

Disable notes for specific notification
The following example will prevent notes from being added to the entry for all notifications with a specific name.
add_filter( 'gform_notification_note', 'gf_disable_notification_notes', 10, 6 );
function gf_disable_notification_notes( $note_args, $entry_id, $result, $notification, $error_info, $email ) {
if ( rgar( $notification, 'name' ) === 'The notification name here' ) {
$note_args = array();
}
return $note_args;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.4.15
Source Code
This filter is located in GFFormsModel::add_notification_note in forms_model.php:

gform_notification_format

gform_notification_format

DescriptionUsageParametersExamplesPlacementSource Code

This filter has been deprecated since Gravity Forms version 1.7. Use the filter gform_notication instead.

Description
Allows the format of the notification email to be changed.
Usage
The following would apply to all forms:
add_filter( 'gform_notification_format', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_notification_format_FORMID)
add_filter( 'gform_notification_format_1', 'your_function_name', 10, 4 );

Parameters

$message_format string
The current message format. The options are html or text.
The default is html.

$message_type string
The current message type, either a user notification or admin notification.

$form Form Object
The current form.

$entry Entry Object
The current entry.

Examples
add_filter( 'gform_notification_format', 'change_message_format', 10, 4 );
function change_message_format( $message_format, $message_type, $form, $entry ){
return 'text';
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in form_display.php in
GFCommon::prepare_user_notification()
GFCommon::prepare_admin_notification()

gform_notification_events

gform_notification_events

DescriptionUsageParametersExamples1. User Registered Event2. Manual Notification Event3. Payment Notification Events4. Mailchimp API failed Notification EventPlacementSource Code

Description
Use this filter to add a new event to the drop down of available triggers for notifications. Additional code is necessary to handle the event since this hook only adds it to the Event drop down on the notifications admin page.
Usage
add_filter( 'gform_notification_events', 'add_event' );

Parameters

$notification_events array
An array of notification events.
$notification_events = array( 'form_submission' => esc_html__( 'Form is submitted', 'gravityforms' ) );
if ( rgars( $form, 'save/enabled' ) ) {
$notification_events['form_saved'] = esc_html__( 'Form is saved', 'gravityforms' );
$notification_events['form_save_email_requested'] = esc_html__( 'Save and continue email is requested', 'gravityforms' );
}

$form Form Object
The current Form object.

Examples
1. User Registered Event
This example adds the trigger 「User is registered」 to the Event drop down on the Notifications page.
add_filter( 'gform_notification_events', 'add_event' );
function add_event( $notification_events ) {
$notification_events['user_registered'] = __( 'User is registered', 'gravityforms' );
return $notification_events;
}

2. Manual Notification Event
This example (by Gravity Wiz) adds the 「Send Manually」 notification event. This can be used in combination with the Resend Notifications feature to manually email users have submitted your form on demand. Read the full tutorial for details.
add_filter( 'gform_notification_events', 'gw_add_manual_notification_event' );
function gw_add_manual_notification_event( $events ) {
$events['manual'] = __( 'Send Manually' );
return $events;
}

3. Payment Notification Events
See the Send Notifications On Payment Events article for code snippets for sending notifications when various payment related events occur.
4. Mailchimp API failed Notification Event
This example adds the trigger 「Mailchimp API Issue」 to the Event drop down on the Notifications page for use in combination with the Mailchimp API Issue custom action example. You can adapt this example for use with any other Add-On Framework based add-on.
add_filter( 'gform_notification_events', function ( $events ) {
$events['mailchimp_api_issue'] = 'Mailchimp API Issue';

return $events;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This action hook is located in GFNotification::get_notification_events() in notification.php