Skip to content

Instantly share code, notes, and snippets.

@geeac
Forked from zachskaggs/gist:469935ff6c0847494402
Created February 19, 2016 12:00
Show Gist options
  • Save geeac/b4884df26e0269490647 to your computer and use it in GitHub Desktop.
Save geeac/b4884df26e0269490647 to your computer and use it in GitHub Desktop.
Ninja Forms Timestamp
<?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