PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Query gravity forms list

  1. Is it possible to do a query_posts and return all the titles/id for the gravity forms?

    what we are trying to do is assign specific forms on specific pages dynamically..

    Posted 12 years ago on Saturday December 10, 2011 | Permalink
  2. No, you can't use query_posts like that because each form is not a post.

    What some people have done is matched the name of the form to the name of the page, and included the form dynamically with a function call. Or, you can store the form ID as a custom field an include it that way.

    Please explain more about how you need this to work and I'm sure we can come up with something for you.

    Posted 12 years ago on Saturday December 10, 2011 | Permalink
  3. The idea is assign the form id dynamically to a page/form using metabox.

    How can i retrieve the list of the forms?

    Is there a hook for that?

    Posted 12 years ago on Sunday December 11, 2011 | Permalink
  4. You can use this to get a list of forms. This code is present in form_list.php:

    [php]
            $forms = RGFormsModel::get_forms("active", "title");

    The get_forms function is defined in forms_model.php if you'd like to take a look at it.

    Posted 12 years ago on Sunday December 11, 2011 | Permalink
  5. is it safe to do something like this in a custom plugin

    $forms = $wpdb->get_results( "SELECT id, title FROM wp_rg_form where is_active=1" );
    Posted 12 years ago on Monday December 12, 2011 | Permalink
  6. It's safe but unnecessary, and would not necessarily be future proof. There's no need to go direct to the database like that, but if it gets the job done for you, it's not hurting anything.

    Posted 12 years ago on Monday December 12, 2011 | Permalink