WP Multisite and Gravity Forms

Hello again

This is a somewhat odd / abstract question (in my mind) so please excuse me if I'm not being clear about what I'm asking.

We're using GF in a large / growing multisite network. Many, but not all, forms will be shared across all sites on the network. However, the forms maybe or may not be imported at the same time - or how ever we decide to maintain them across the network. The point being, the Contact Us could be GF form ID 3 on one site, GF form ID 1 on another site and GF form ID 5 on so on...

The GF actions / filters have form-centric settting. That is, (for example) gform_after_submission_form_id_X will fire when form_id_X is submitted. The problem is, that isn't going to be specific / fixed for every site (as already mentioned).

My idea is to add a hidden field to each form. Something that we define and will be consistent across all forms. That is, Contact Us will always be hidden my_form_id contact_us. Again, for example. Therefore, I can check for that value and then do whatever post-submit filtering / action I'm wanting to do.

What do you think about this? Is there another / better way to meet our ends? In short, I have forms. Some of those forms have backend code associated code with them and I want to make sure I fire the right code for the right forms at the right time. And using the GF form ID isn't consistent / unqiue (so to speak) across all sites on the network.

Make sense?

Your thoughts?

Thanks in advance.

mfs

  • Jack Kitterhing
    • Code Norris

    Hi there @ChiefAlchemist

    I hope you are well today and thank you for your question.

    I sort of understand what you'd like to do, basically you require a unique ID for each form for each subsite across the network, to match that form to another function? Or is that incorrect, please advise.

    Thank you!

    Kind Regards
    Jack.

  • ChiefAlchemist
    • Design Lord, Child of Thor

    Hey Jack

    Yes (I think).

    I want / need a user (read: developer) defined form ID that stays with the form (read: XML) regardless of what form ID GF assigns to the form for it's purposes. One of my primary concerns is I'm using the GF actions and filters and some / most of them are form-centric. That is, only run this snippet when Form X is submitted. Well if form X is X, Y or Z then I'm well, um...screwed :slight_smile: At least from a highly scaled multisite perspective.

    I know you guys don't support Gravity Forms. But I also know there's quite a bit of experience in and around WPMU, that's why I'm a member / subscriber :slight_smile: I figured someone might have already run into similar and has an answer.

    The closest I see is I can re-appropriate a field in GF for my purposes. That said, that feels VERY dirty to me and perhaps open to screw-up if someone else doesn't know. Another alternative would be to maintain some sort of table, but again that seems sub-optimal.

    The list goes on and on but all of them feel dirty and not worthy of a 20 to 30+ MS corporate install. If ya know what I mean :wink:

    Thanks. I hope you can help.

  • Jack Kitterhing
    • Code Norris

    Hi there @ChiefAlchemist

    I hope you are well today and thanks for the additional information much appreciated.

    Makes perfect sense, though like you say with Gravity forms, I'm not 100% on how this could be done, I believe that the hidden field may be the best way of doing this.

    I'm going to speak with some colleagues about this and see what they say, thanks for your patience.

    Kind Regards
    Jack.

  • ChiefAlchemist
    • Design Lord, Child of Thor

    Agreed. Hidden field is best.

    At the moment I just can't get my head wrapped around the best way from Point A to B. I've seen the object with the form fields but best I can tell GF doesn't let me name a hidden field. I could try using writing to the post meta but again, that feels sloppy and not even form is tied to a post.

    I've been in love with GF. Nice product. But I'm kinda shocked that I'm the first people to raise this red flag.

  • ChiefAlchemist
    • Design Lord, Child of Thor

    what if I added my own HTML in the form. Defined my own hidden. At that point I would hope I could still get the $_POST, yes?

    The only loss would be the hidden wouldn't write to the GF entries table. NBD really. It's not a value I'm looking to store. It's just a flag that I want to monitor so I can make wise / sensible decisions once a form is submitted.

    Ya think?

    I know I can test it. But I wanted to ask first before I get lost in an whole-afternoon time suck. :slight_smile:

  • ChiefAlchemist
    • Design Lord, Child of Thor

    FYI - I had a moment to experiment and using GF's HTML to add my own hidden to the form and then picking up that hidden from $_POST appears to do the trick. I would think I shouldn't have a problem with $_POST not being available early enough, eh?

    For now I'm going to presume the crux of my problem is solved :slight_smile:

    I also have a request in to GF. If they have anything important to add I'll share it here. I'm sure there's something else about doing GF+MS this way but it's probably a coding issue and not a flat out how do I do this.

    Thanks again!

  • ChiefAlchemist
    • Design Lord, Child of Thor

    Howdy Jack

    My experimental / proof of concept worked. I'm pretty confident $_POST should be a safe way to get the name + value pair I need,

    My next step is to suss out the broader architecture and how to setup the methods / plugins for the filters and actions. I'm thinking i continue to have a form_id as an int, but I'll define that int with my own name. and then filters and actions that are id specific (as they should be) won't get mucked up, right?

    We'll see but it makes sense to me.

  • Jack Kitterhing
    • Code Norris

    Hi there @ChiefAlchemist

    I hope you are having a great weekend! Great glad to hear that is working :slight_smile:

    It shouldn't get messed up no, but I wouldn't like to guarantee that, as I have never personally done that myself, did you try it out? Did it work :slight_smile:

    Thank you!

    Kind Regards
    Jack.

  • Jack Kitterhing
    • Code Norris

    Hi there @ChiefAlchemist

    Thanks for your understanding :slight_smile: I do indeed myself use GF, so if you get part way there or are stuck on a specific thing like a piece of code not doing what you think it should, let me know and I'll take a look :slight_smile:
    Thank you!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.