• Resolved Uncle Matt

    (@uncle-matt)


    First of all I’d like to say thanks to developers for the outstanding Pods plugin.

    Using Pods Gravity Forms Add-on I met next problem.
    I use native Pods’ hooks (for examle, ‘pods_api_post_save_pod_item’) for post-processing of pod’s data. It works fine from the back-end. But when I use GF (with Pods GF add-on) for posting data from the front-end after new pod item is created my hooks don’t work.

    Could you please suggest how I can handle it in Pods GF? Or I should use certain Gravity Forms hooks for it? I afraid that in second case I’ll multiple count of queries to database and thats not so good for site performance.

    • This topic was modified 5 years, 6 months ago by Uncle Matt.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    When do you add your post save hook? Gravity Forms hooks all run pretty early.

    Thread Starter Uncle Matt

    (@uncle-matt)

    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.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    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”?

    Thread Starter Uncle Matt

    (@uncle-matt)

    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 🙂

    Thread Starter Uncle Matt

    (@uncle-matt)

    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.

    Plugin Author Jim True

    (@jimtrue)

    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!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to use native Pods’ hooks in GF?’ is closed to new replies.