Created
June 24, 2022 11:24
-
-
Save adczk/e928a6096cd40cb76d0491c46a08694b to your computer and use it in GitHub Desktop.
Forminator - hide form before certain date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * MU PLUGIN | |
| * | |
| * hides forminator form until set date | |
| * | |
| * use as MU plugin | |
| * tested with Forminator 1.17.0 | |
| * | |
| * by Adam/WPMU DEV | |
| */ | |
| add_action( 'forminator_render_form_markup' , 'wpmu_form_render_before_time', 10, 4 ); | |
| function wpmu_form_render_before_time( $html, $form_fields, $form_type, $form_settings ) { | |
| $hide_id = 14150; // ID of the form to be hidden; | |
| $hide_date = '2022-06-23'; // show form date in format YYYY-MM-DD | |
| $msg = 'FORM NOT YET AVAILABLE'; // message to show if form not yet available | |
| ##### DO NOT EDIT BELOW ##### | |
| $hide_date = strtotime( $hide_date ); | |
| $current_date = time(); | |
| if ( ( $form_settings['form_id'] == $hide_id ) && ( $hide_date > $current_date ) ) { | |
| $html = $msg; | |
| } | |
| return $html; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment