When do you add your post save hook? Gravity Forms hooks all run pretty early.
English is not my native language and some misunderstandings may occurs.
1. I don’t use Gravity Forms hooks. As I mentioned above I use hook ‘pods_api_post_save_pod_item’.
2. This hook I use in my plugin module (not in function.php of a theme).
3. This hook doesn’t work for new pod records just created by GF.
I’m looking a way to make it working for Gravity Forms. And question is should native pods hooks (‘pods_api_post_save_pod_item’) be working under GF or I have to use GF hooks to call them.
Sorry, I meant where exactly are you running your add_filter()
call? Is it directly in functions.php? Is it within another function that runs during a certain action like “init”?
Thank you for the reply!
I’m running two filters in my own plugin module:
– add_filter(‘pods_api_pre_create_pod_item’,’my_function_1′,10,1);
– add_filter(‘pods_api_pre_save_pod_item’,’my_function_2′,10,2)
They work fine while I create new pods item from the back-end (admin dashboard).
After your first comment I have already tried to change order of plugins load using ‘Plugin Organizer’. Initially GF was #1, but after changes I made GF loading after Pods and my plugin. There is no difference.
Now I’m trying to test Scott Clark approach. I’m still working on it. But as I mentioned ealier using action in this case not so good from performance point.
I have also investigated source code of Pods GF (to get sure are native pods’ hooks working here or not), but because of my humble php-skills couldn’t find point where new pods item is adding 🙂
If you are interested, I’ve found the root of the problem. Now everything works ok.
As I wrote earlier in my application some fields are processed after pods item is created. For this reason I’ve decided do not create fields in Gravity Forms for them and of course do not map them with sister pods fields. Unfortunaly in this case ‘pods_api_pre_create’ and ‘_pre_save’ hooks doesn’t work.
Then I decided to create hidden fields in Gravity Forms and map them with needed pods fields. And now it works.
I think it is a small bug. No matter are all pods fields are filled or not main event is new pods item is created.
That actually doesn’t sound like a bug if you didn’t want to process those fields until after they were created in Pods, you definitely wouldn’t want them in your form in that case.
The hidden fields approach makes sense to me. Glad you worked out a solution!