• Resolved floris246

    (@floris246)


    Hi,

    I would like to fetch all submitted values for a Advanced Forms field. How to do this in PHP? I can’t find the functionality in forms-api.php.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter floris246

    (@floris246)

    I fixed this by inserting a custom post type entry on the af/form/submission hook.

    In other words, when the form is being processed I insert a new post (with the post type petition in my case) and use the add_post_meta function to insert the field data needed.

    Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi! That’s a very nice solution and a common use case. AF Pro includes the ability to create and edit posts if you are interested!

    You don’t need to use the add_post_meta function either. My plugin has a helper function called af_save_all_fields which can automatically save all fields to a post. Use it like this: af_save_all_fields( $post_id );

    For future reference, the generated entries are actually regular custom post types and can be fetched using a regular WP_Query targeting the af_entry post type. The field data is saved as regular ACF fields and can be retrieved with get_field.

    Glad you figured it out!

    Thread Starter floris246

    (@floris246)

    Thank you. That is helpful information. It might be nice to add functions to the AF API class like get_field_entries($field_name). It’s powerful if you can tell in one second what the function does only by applying a clear function name for such helper function.

    Anyway I just bought AF Pro (on our Blue Dragon account). Good to see you guys have a lifetime license, really like it. Cheers.

    Plugin Author fabianlindfors

    (@fabianlindfors)

    I’ll consider adding that! Seems like a nice function to have. ??

    Thank you for purchasing AF Pro! For clarification our licenses are for 1 year of updates and support but cover an unlimited amount of installs.

    Thread Starter floris246

    (@floris246)

    I think you are making a mistake? The site states literally ‘Lifetime updates for Unlimited Sites’.

    If it is only for one year that makes your plugin instantly too expensive to have. Just giving my honest opinion here.

    Update: Aha, I mean Advanced Custom Fields Pro. :o)

    Strangely enough WordPress forms plugins need to be payed yearly (and be very, very, expansive that way). That’s the reason I didn’t end up with the WP Forms plugin for example.

    • This reply was modified 6 years, 7 months ago by floris246.
    • This reply was modified 6 years, 7 months ago by floris246.
    • This reply was modified 6 years, 7 months ago by floris246.
    • This reply was modified 6 years, 7 months ago by floris246.
    Plugin Author fabianlindfors

    (@fabianlindfors)

    I’m sorry, on which page does it say lifetime updates?

    Plugin Author fabianlindfors

    (@fabianlindfors)

    Oh, I see! Yes, ACF does have a very favorable license. I opted into a yearly license to ensure I can continue updating and supporting the plugin.

    If you regret your purchase we do offer a 30-day money back guarantee. You can create a support ticket here: https://hookturn.io/contact/

    Sorry about the confusion! ??

    Thread Starter floris246

    (@floris246)

    Awesome, indeed the af_save_all_fields() does the same as the billion add_post_meta() lines I used. Thanks.

    • This reply was modified 6 years, 6 months ago by floris246.
    • This reply was modified 6 years, 6 months ago by floris246.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to get AF entries with php’ is closed to new replies.