Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Created March 30, 2014 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbernar1/9866571 to your computer and use it in GitHub Desktop.
Save dbernar1/9866571 to your computer and use it in GitHub Desktop.
Custom Gravity form submission processing
<?php
/**
* Plugin Name: My custom Gravity form submission processing plugin
*/
// We will use photo contest entry submissions as the example
when_a_gravity_form_is_submitted( 'check_whether_it_is_a_contest_entry_submission' );
when_a_contest_entry_is_submitted( 'do_some_custom_processing' );
// Details
function when_a_gravity_form_is_submitted( $do_this ) {
add_action( 'gform_after_submission', $do_this );
}
define( 'PHOTO_CONTEST_FORM_ID', '2' );
function check_whether_it_is_a_contest_entry_submission( $user_submission ) {
if ( $this_is_a_photo_contest_submission = PHOTO_CONTEST_FORM_ID === $user_submission[ 'form_id' ] ) {
do_action( 'photo_contest_was_submitted', $user_submission );
}
}
function when_a_contest_entry_is_submitted( $do_this ) {
add_action( 'photo_contest_was_submitted', $do_this );
}
function do_some_custom_processing( $user_submission ) {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment