WordPress.org

Support

Support » Plugins and Hacks » Gravity Forms + Custom Post Types » [Plugin: Gravity Forms Custom Post Types] Meta fields in an array?

[Plugin: Gravity Forms Custom Post Types] Meta fields in an array?

Viewing 9 replies - 1 through 9 (of 9 total)
  • I’m looking for the exact same functionality. I’m working with a theme that already has a ton of information populated and built in, but they use arrays instead of separate custom fields and I can’t populate them from a Gravity Form. I’d love to find out how to do this!

    Plugin Author bradvin

    @bradvin

    This can definately be done, but as you say it would require some hacking. The best way I can think of catering for this is to add a checkbox under advanced settings for the custom field. something like:

    [x] Save value to array
    Array key [___________________________]

    so when you check “save value to array” it shows another textbox “array key” where you can enter the key used in the array eg. ‘first_name’

    Would something like that work for you?

    I think that would definitely work. Seems a lot more elegant than the hacks I’m seeing of converting every array to individual custom fields. How difficult would it be to add the functionality?

    That’d definitely work. It seems like we’d have to lean on Gravity Forms for something like that, no?

    Plugin Author bradvin

    @bradvin

    I can give it a go. Not sure if it should be part of the GF+CPT plugin though. What do you think?

    Might be too edge case to build into the plugin, but if you at least knew what we could add to the code to make it happen I’d be happy with that solution. My guess is GF would never build it into their code base because of how small the likelihood is that someone would run into a situation like that, but I’d love it if we could make it work within this plugin. 🙂

    Guys I have a theme that users a custom post type which has its own meta box – it appears they are setup as arrays somehow. I really need gravity forms to talk to these boxes as ive got everything else working but i need these boxes in.

    Did you ever add this option/hack to the plugin?

    Plugin Author bradvin

    @bradvin

    we never added this option to the plugin, as it was too “edge case”, but people have done this by creating their own little plugin that hooks into the GF set_post_values filter

    Would anyone have such a plugin to share? Thats a little beyond my coding abilities and if its already been done…?

    For the record this is the code in the theme which creates the meta box in the custom post type of “portfolio”. Would the set_post_values filter work for this upon first glance?

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Gravity Forms Custom Post Types] Meta fields in an array?’ is closed to new replies.
Skip to toolbar