GF entries count without storing user data

Hi there. I have a GF form that takes submissions and pushes the info to a MailChimp audience. On my site, I need to show the total number of people that have made submissions. In my case “XX people have made pledges”. No problem here, I have that working fine.

My issue is that I can’t store any of the personal information in GF. So as soon as the submission is created and pushed to Mailchimp, the entry needs to be removed from GF. Again, I see ways to do this. However, I still need to be able to track the total number of pledges despite the entries being deleted. Since my entries are being deleted automatically, my total count no longer works.

Any ideas?

I’d recommend storing the pledge count to the *_wp_options table and incrementing that value when each submission comes in using code hooked to gform_after_submission. This would keep the count independent of the stored entries. You can then pull the count directly from that option.

Ah nice – I’m a bit of a WordPress novice but I was able to get it working with your suggestion using:

add_action( ‘gform_after_submission’, function() {
$total_pledges = get_option( ‘pledge_count’ ) + 1;
update_option( ‘pledge_count’, $total_pledges );
});

Not sure if this should be written different, but it seems to work.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.