-
-
Save geeac/b4884df26e0269490647 to your computer and use it in GitHub Desktop.
Ninja Forms Timestamp
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 | |
/* | |
Plugin Name: Example Plugin | |
*/ | |
<?php | |
function my_ninja_forms_date_code(){ | |
//Declare $ninja_forms_processing as a global variable. | |
global $ninja_forms_processing; | |
//only process this code on the form ID 1 | |
$form_id = $ninja_forms_processing->get_form_ID(); | |
if( $form_id == 1 ){ | |
//sets timestamp variable to current time | |
$timestamp = date('h:i:s A'); | |
//Update the hidden field value for the field with an ID of 3 to the current time. | |
$ninja_forms_processing->update_field_value( 3, $timestamp ); | |
} | |
} | |
add_action( 'ninja_forms_process', 'my_ninja_forms_date_code' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment