Custom Gravity form submission processing
This file contains 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: 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