I need to grab data of entry after post submit, i.e:
function update_campaign_amount($entry, $form) {
$donate_to_personal_camp_form = get_option('als_donate_to_personal_camp_form');
$main_campaign_form = get_option('pb_main_campaign');
if ( $form['id'] == $donate_to_personal_camp_form ) {
$campaign_id = $entry['55'];
$user_donation = $entry['4'];
$total_donations = get_post_meta($campaign_id, 'campaign_current_amount', true);
if (is_numeric($user_donation)) {
update_post_meta($campaign_id, 'campaign_current_amount', $total_donations + $user_donation);
}
}
}
add_action( 'gform_after_submission', 'update_campaign_amount', 10, 2 );
As you can see in the code the two variable $campaign_id and $user_donation gets the value of a specific entries, it works but it doesn't good enough, because today the number of the entry is 55, tomorrow it could be something else.. Is there any other options to get entry value? For example, I have only one field on that form with the type "total", and I need it's value, so I want to do something like:
$entry['type'] == 'numer'
But I could find anyway to get entry data without the use of absolute numbers. Anyone know more flexible way?