Disable All Dates & Set Enabled Dates via Exceptions

Instructions

Code

Filename: gpld-disable-all-dates-with-exceptions.php

<?php
/**
 * Gravity Perks // Limit Dates // Disable All Dates & Set Enabled Dates via Exceptions
 * https://gravitywiz.com/documentation/gravity-forms-limit-dates/
 *
 * Instruction Video: https://www.loom.com/share/46883f47e71447108f70fd725af8ee97
 */
add_filter( 'gpld_limit_dates_options_123_1', function( $options, $form, $field ) {

	$options['exceptionMode'] = 'enable';
	$options['disableAll']    = true;

	return $options;
}, 10, 3 );

Comments

  1. Emiel Kamzol
    Emiel Kamzol October 15, 2024 at 1:12 am

    It seems that if I apply this snippit that it applies to all forms. Is it also possible that I apply this snippit only to form X? Sorry but I have pretty little understanding of PHP/Javascript etc. So maybe it’s a stupid question.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff October 16, 2024 at 10:03 am

      Hi Emiel,

      The snippet in its current form is designed to apply to a specific form and a specific date field on the form. You’ll update ‘123’on the hook name to the form ID and 1 to the Date field ID. add_filter( 'gpld_limit_dates_options_123_1', function( $options, $form, $field ) {

      If you’re experiencing different, please submit a ticket via our support form, so we look into this further on your website.

      Best,

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.