Using Gravity Forms ‘gform_entry_meta_conditional_logic_confirmations’ PHP filter

The gform_entry_meta_conditional_logic_confirmations filter enables the entry meta conditional logic filters to be modified on the confirmation edit page.

Usage

add_filter('gform_entry_meta_conditional_logic_confirmations', 'conditional_logic_filters', 10, 3);

Parameters

  • $entry_meta (array): The entry meta.
  • $form (array): The form object.
  • $notification_id (string): The notification id.

More information

See Gravity Forms Docs: gform_entry_meta_conditional_logic_confirmations

Examples

Remove entry meta filters based on form settings

This example removes certain entry meta filters depending on the form settings.

add_filter('gform_entry_meta_conditional_logic_confirmations', 'conditional_logic_filters', 10, 3);

function conditional_logic_filters($filters, $form, $id) {
    $quiz_fields = GFAPI::get_fields_by_type($form, array('quiz'));

    if (empty($quiz_fields)) {
        return $filters;
    }

    switch (self::get_form_setting($form, 'grading')) {
        case "letter":
            if (false === isset($form['gquizDisplayConfirmationLetter']) || $form['gquizDisplayConfirmationLetter']) {
                unset($filters['gquiz_is_pass']);
            }
            break;
        case "passfail":
            if (false === isset($form['gquizDisplayConfirmationPassFail']) || $form['gquizDisplayConfirmationPassFail']) {
                unset($filters['gquiz_grade']);
            }
            break;
        default:
            unset($filters['gquiz_grade']);
            unset($filters['gquiz_is_pass']);
    }

    return $filters;
}

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

Source Code: This action hook is located in GFFormSettings::confirmations_edit_page() in form_settings.php.