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.

Hooks and Filters Example Improvement

  1. The second example on this page has hardcoded table prefixes: http://www.gravityhelp.com/documentation/hooks-and-filters/

    This could easily confuse someone less familiar with SQL / hacking wordpress.

    Below is an example that will work with any table prefix, not just "wp_"

    add_action("gform_post_submission", "post_submission_handler");
    function post_submission_handler($entry){
        global $wpdb;
    
    	$t_rg_lead = $wpdb->prefix . "rg_lead";
    	$t_rg_lead_detail = $wpdb->prefix . "rg_lead_detail";
    
        $results = $wpdb->get_results($wpdb->prepare("  SELECT l.*, field_number, value
                                FROM $t_rg_lead l
                                INNER JOIN $t_rg_lead_detail ld ON l.id = ld.lead_id
                                WHERE l.id=%d
                                ORDER BY  l.id, field_number", $entry["id"]));
    
        foreach($results as $result){
            echo "<hr/>Entry Id: " . $result->id . "<br/>";
            echo "Field Number: " . $result->field_number . "<br/>";
            echo "Field Value: " . $result->value . "<br/>";
        }
    }
    Posted 13 years ago on Tuesday August 31, 2010 | Permalink
  2. The documentation is getting ready to overhauled entirely. The content is ready, we are working on the integration as we are using MediaWiki to manage the content. The Developer related documentation is much more extensive and covers all of the available API hooks.

    Posted 13 years ago on Tuesday August 31, 2010 | Permalink
  3. Awesome, glad to hear. I look forward to seeing how this project grows.

    While a few things are unfortunately not catering to my immediate needs, I have no doubt it will grow to suit them.

    Posted 13 years ago on Tuesday August 31, 2010 | Permalink
  4. gmcalp
    Member

    Carl, when will the new MediaWiki pages become available?

    Posted 13 years ago on Thursday September 2, 2010 | Permalink
  5. Once the integration between MediaWiki and our support site has been completed. Hopefully within the next couple weeks.

    Posted 13 years ago on Thursday September 2, 2010 | Permalink
  6. gmcalp
    Member

    So, to use the above code, how exactly would I call that in a page template? How would I define which form to get the data from?

    Posted 13 years ago on Friday September 3, 2010 | Permalink
  7. gmcalp
    Member

    Carl, it's been 6 months since your post above announcing the fact you are doing an overhaul of the documentation. Any idea when the wiki is going to be launched?

    I would still like to use hooks/filters but am still not quite sure how to implement them.

    Posted 13 years ago on Thursday March 17, 2011 | Permalink
  8. @gmcalp The new site will launch next week along with the final releases of the products in development. It's more than adding a wiki, it's an entirely new site (both marketing and support site, including the forums).

    The scope of what became Gravity Forms v1.5, the new site, etc. expanded greatly from our initial plans.

    Posted 13 years ago on Thursday March 17, 2011 | Permalink

This topic has been resolved and has been closed to new replies.