Instantly share code, notes, and snippets.

Embed
What would you like to do?
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