Using Gravity Forms ‘gform_print_entry_disable_auto_print’ PHP action

The gform_print_entry_disable_auto_print filter disables auto-printing when the Print Entry view has fully loaded in Gravity Forms.

Usage

To apply this filter to all forms, use the following code:

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

To target a specific form, append the form ID to the hook name (format: gform_print_entry_disable_auto_print_FORMID):

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

Parameters

  • false (bool): Auto-print is enabled by default. Set to true to disable.
  • $form (Form Object): Current form object.

More information

See Gravity Forms Docs: gform_print_entry_disable_auto_print

This filter was added in Gravity Forms version 1.9.14.16 and is located in print-entry.php.

Examples

Disable auto-print for all forms

Disable auto-print when the Print Entry view has fully loaded for all forms.

add_filter('gform_print_entry_disable_auto_print', '__return_true', 10, 2);

Disable auto-print for a specific form

Disable auto-print when the Print Entry view has fully loaded for a specific form with form ID 2.

add_filter('gform_print_entry_disable_auto_print_2', '__return_true', 10, 2);

Disable auto-print based on a form field value

Disable auto-print for a form with form ID 3 if a specific field (field ID 5) has a certain value (“Do not print”).

function disable_autoprint_based_on_field_value($disable_autoprint, $form) {
    $entry = GFFormsModel::get_current_lead();
    if ($entry[5] == "Do not print") {
        return true;
    }
    return $disable_autoprint;
}
add_filter('gform_print_entry_disable_auto_print_3', 'disable_autoprint_based_on_field_value', 10, 2);

Disable auto-print based on the user role

Disable auto-print for a form with form ID 4 if the current user has the “editor” role.

function disable_autoprint_for_editors($disable_autoprint, $form) {
    $current_user = wp_get_current_user();
    if (in_array('editor', $current_user->roles)) {
        return true;
    }
    return $disable_autoprint;
}
add_filter('gform_print_entry_disable_auto_print_4', 'disable_autoprint_for_editors', 10, 2);

Disable auto-print for a form using a custom function

Create a custom function to disable auto-print for a form with form ID 5.

function my_custom_disable_autoprint($disable_autoprint, $form) {
    // your custom code here
    return true;
}
add_filter('gform_print_entry_disable_auto_print_5', 'my_custom_disable_autoprint', 10, 2);