I put this code in my functions.php file:
add_action( 'gform_after_submission_6', 'record_upload_to_database', 10, 2 );
function record_upload_to_database( $entry, $form ) {
print "In function!";
GFCommon::log_debug( __METHOD__ . '(): running.' );
}
(and I enabled logging), but after submitting an entry (through the form with the ID of 6), I’m not seeing that print statement on the form’s confirmation page, nor do I see the log statement in the log file. So, it seems that this code isn’t being executed after entries are submitted with the form, and I was hoping that someone could help me troubleshoot this? Thanks!
Hi Nancy,
The code has some typo errors. The method should be called as __METHOD__
. Here is the updated code you can find below.
function record_upload_to_database( $entry, $form ) {
echo "In function!";
GFCommon::log_debug( __METHOD__ . '(): running.' );
}
add_action( 'gform_after_submission_6', 'record_upload_to_database', 10, 2 );
I got the following error from your code:
After fixing the code, the logging is working fine.
Give it a try, and let me know how that goes!
Thanks so much for your reply, Faisal! For some reason the “In function!” message still isn’t printing to the screen, but that doesn’t really matter (since I only put in that print statement for testing purposes). All that matters to me, is that I am now seeing the statements in the log file generated by the call to GFCommon::log_debug in my record_upload_to_database function, because this means that code inside my record_upload_to_database function is indeed being executed (which was what I was trying to verify, with these diagnostics). So we may consider this issue to be officially “closed”, and thanks again for your help!