Created
January 27, 2016 23:03
-
-
Save JustinSainton/e79e53dc6d02903bc3e7 to your computer and use it in GitHub Desktop.
Use existing Gravity Forms notification on non-form data
This file contains hidden or 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 | |
$form_id = 12; // Or whatever form ID has the notificaiton you're after | |
$form = GFAPI::get_form( $form_id ); | |
$notification = end( $form['notifications'] ); // Just an easy way to get the notification I wanted. YMMV. | |
$lead = array( | |
'id' => wp_generate_password( 64, true, true ), // Normally, this would be the Lead ID. Not necessary for us. | |
'form_id' => $form_id, | |
'source_url' => 'https://site.com/', | |
'status' => 'active', | |
'1.3' => $args['first_name'], // YMMV on these args - set them to whatever your form sets them to be. | |
'1.6' => $args['last_name'], | |
'2' => $args['user_email'], | |
'4' => $args['term_id'], | |
'5' => $args['user_pass'], | |
'1.2' => '', | |
'1.4' => '', | |
'1.8' => '' | |
); | |
GFCommon::send_notification( $notification, $form, $lead ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment