Well, I figured out two ways, one is a custom SQL query, the other a call to the internal class RGFormsModel:
Option 1:
global $wpdb;
$summary = $wpdb->get_results("SELECT COUNT(*) FROM wp_rg_lead WHERE form_id = 2");
echo "The Form count for Form #2 is: $summary.";
Option 2:
$summary = RGFormsModel::get_form_counts(2);
echo "The Form count for Form #2 is: ".$summary['total'].".";
They both work. Anyone have an opinion on whether either (or both) of these methods is flawed in some way that I haven't realized? Or have an opinion on which approach is better or faster?
Oh, I should point out that the "2" in both "form_id = 2" and "get_form_counts(2)" is the form id from the first column of the "Edit Forms" page in the Gravity Forms admin area.
Posted 14 years ago on Wednesday March 10, 2010 |
Permalink