Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Last active March 23, 2020 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjohnson/87ee6f3d3b6c252f6a0a9ff8c88ae8ce to your computer and use it in GitHub Desktop.
Save kjohnson/87ee6f3d3b6c252f6a0a9ff8c88ae8ce to your computer and use it in GitHub Desktop.
<?php
/**
* @tag my_ninja_forms_processing
* @callback my_ninja_forms_processing_callback
*/
add_action( 'my_ninja_forms_processing', 'my_ninja_forms_processing_callback' );
/**
* @param $form_data array
* @return void
*/
function my_ninja_forms_processing_callback( $form_data ){
$form_id = $form_data[ 'form_id' ];
$form_fields = $form_data[ 'fields' ];
foreach( $form_fields as $field ){
$field_id = $field[ 'id' ];
$field_key = $field[ 'key' ];
$field_value = $field[ 'value' ];
// Example Field Key comparison
if( 'my_field' == $field[ 'key' ] ){
// This is the field that you are looking for.
}
}
$form_settings = $form_data[ 'settings' ];
$form_title = $form_data[ 'settings' ][ 'title' ];
}
@cb49747
Copy link

cb49747 commented Mar 30, 2018

I'm trying to write my own payment api, using ninja forms. Where would I save my custom action function?

@zachskaggs
Copy link

@iasoule
Copy link

iasoule commented Jan 27, 2020

I'm trying to write my own payment api, using ninja forms. Where would I save my custom action function?

You should save the action in your themes' function.php file. Further detail is here

@lameventanas
Copy link

Dear link. What's up with all the bad quality documentation in this project? Lots of docs, but low quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment