Is it possible to disable entry creation but still show the number of submissions?
Kind regards,
Edward
Is it possible to disable entry creation but still show the number of submissions?
Kind regards,
Edward
Hi Edward. You can deactivate the form, or set the entry limit to the number of entries your form has, so that it won’t accept more entries. Then you can use this free solution from Gravity Wiz to show the number of entries for a form:
Does that work for you?
Hi Chris,
Thank you for your reply!
Sorry, I think I was not clear enough.
I still want the form to be used, but I don’t want to save submissions. I still would like to see how many people filled in the form. Is that possible?
Hi Edward. Much of Gravity Forms’ functionality depends on an entry being created. For that reason, you can’t stop the entry from being created, but you can delete it immediately if you don’t want to save it.
That is going to present a problem for you, since you won’t have any entries to count.
Can I ask why you don’t want to save entries?
Hi Chris,
I am building a quiz where users get a certain result and some info.
The only thing that is important for me is the number of submissions. I don’t need to see the data users filled in, that would save some database space.
Hi Edward. I understand. I think you might have to do something custom, like increment a counter in the database or something. You could use the same hook (gform_after_submission) to increment the counter, then delete the entry. So in this code:
// Target submissions from form ID 1.
// Change gform_after_submission_1 to reflect your target form ID, or use gform_after_submission to target all forms.
add_action( 'gform_after_submission_1', 'remove_form_entry' );
function remove_form_entry( $entry ) {
GFAPI::delete_entry( $entry['id'] );
}
You would somewhere count the submission right before deleting the entry. You could create a database table, then connect to that table using the wpdb
class:
https://developer.wordpress.org/reference/classes/wpdb/
Creating the table and creating the code to increment a counter, or add a record, is outside the scope of code snippets we can provide, but I will leave this open in case someone has a solution to share.
Hi Chris,
Thanks you very much! I will give it a try.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.