Created
September 26, 2018 01:49
-
-
Save Idealien/8fb26ba57600d26d54b4b3ce8126035c to your computer and use it in GitHub Desktop.
Example of post-workflow step calculations
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 | |
add_action( 'gravityflow_post_webhook', 'sh_action_gravityflow_post_webhook', 10, 4 ); | |
function sh_action_gravityflow_post_webhook( $response, $args, $entry, $current_step ) { | |
//Replace step ID and fields for calculation to match your use case. | |
if ( $current_step->get_id() == 77 && is_numeric( $entry['3'] ) && is_numeric( $entry['16'] ) ) { | |
$entry['14'] = round( $entry['3'] * $entry['16'], 2); | |
$result = GFAPI::update_entry( $entry ); | |
} | |
} |
Hello again
Thank you very much
I was submit in there and if it will be solved, ill share it for sure!
If you dont like my comments to be here, im sory for that an i can delete them quiekly
Thanks again and Good Bye.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your snippet is modifying the $entry which is not part of $response which is what the filter returns back to the rest of Gravity Flow for processing. You use the GFAPI to update the entry, but it is most likely that Gravity Flow would use the values in $response after your filter runs to update the entry. The doc you linked to provides good examples of how your code should be structured or you may want to review https://developer.wordpress.org/reference/functions/add_filter/ as both issues are concepts that the core of WP approach to hooks covers.