I have been trying to find the selected choice of a multiple choice field (could be radio buttons or list etc doesn’t matter), After an entry has been modified in wordpress’s backend.
Currently i’m trying to do it inside a function fired by the hook gform_post_update_entry_property but maybe it’s not the right hook/filter ?
I was using this one because i assumed i could directly use the $value or $property function parameters but no such luck.
I’ve tried these 2 methods on multiple types of fields with no success:
Thank you for taking the time to look at my issue.
So i have a form with an administration field that has 3 option “Pending” “Validated” “Error”.
Each entry from that form will be reviewed manually in the back-end of wordpress.
What i need is a hook that gets triggers after one of these entry has been updated AND have access inside of that function to that field and be able to know wich of the option was selected.
Ideally i’d prefer doing it using gravity forms functions, but i could also pull the result directly from the database if there’s no other way.
I think the hook i tried using triggered before the database was updated with this field’s meta value, hence why i couldn’t see wich of the field’s choices had been selected.
You can use the gform_after_update_entry hook for that:
gform_post_update_entry_property would only run after updating an entry property, like the date submitted, read status, starred status, etc. The gform_after_update_entry hook runs after updating an entry (like changing the status to Pending/Validated/Error) and has access to the original entry, and the entry ID, so you should be able to do what you want there. Let us know if you have any other questions.
The filter which Chris linked to is absolutely the right call for handling updates via the Forms > Entries screen in the admin. Have you looked at Gravity Flow by chance?
There are also a wide variety of hooks that would let you customize where needed. From your initial description, using gravityflow_step_complete following a successful approval might be a good place to take whatever action is needed “After an entry has been modified”.
The gform_after_update_entry hook was exactly what i was looking for.
I struggled a bit at first but it was because i didn’t read the doc properly and didn’t realised the first $entry parameter was an ID and not an entry object.
But after adding this line everything works exactly as intended:
function after_entry_modif($form, $entry_id){
$entry = GFAPI::get_entry( $entry_id );
As for the gravity flow pluggin i don’t think it will be necessary given this is a pretty small project, but i’ll keep it in mind in case we ever scale up.