<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: count of approved entries with get_lead_count ??</title>
		<link>https://legacy.forums.gravityhelp.com/topic/count-of-approved-entries-with-get_lead_count</link>
		<description>Gravity Support Forums Topic: count of approved entries with get_lead_count ??</description>
		<language>en-US</language>
		<pubDate>Thu, 30 Apr 2026 05:31:19 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/count-of-approved-entries-with-get_lead_count" rel="self" type="application/rss+xml" />

		<item>
			<title>boodcode on "count of approved entries with get_lead_count ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/count-of-approved-entries-with-get_lead_count#post-67865</link>
			<pubDate>Wed, 25 Jul 2012 10:33:24 +0000</pubDate>
			<dc:creator>boodcode</dc:creator>
			<guid isPermaLink="false">67865@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;the complete function is :&#60;/p&#62;
&#60;p&#62;function get_lead_count($form_id, $search, $star=null, $read=null, $column, $approved = false, $leads = array(), $start_date = null, $end_date = null, $limituser = false){&#60;br /&#62;
		global $wpdb, $current_user;&#60;/p&#62;
&#60;p&#62;		if(!is_numeric($form_id))&#60;br /&#62;
			return &#34;&#34;;&#60;/p&#62;
&#60;p&#62;		$detail_table_name = RGFormsModel::get_lead_details_table_name();&#60;br /&#62;
		$lead_table_name = RGFormsModel::get_lead_table_name();&#60;/p&#62;
&#60;p&#62;		$star_filter = $star !== null ? $wpdb-&#38;gt;prepare(&#34;AND is_starred=%d &#34;, $star) : &#34;&#34;;&#60;br /&#62;
		$read_filter = $read !== null ? $wpdb-&#38;gt;prepare(&#34;AND is_read=%d &#34;, $read) : &#34;&#34;;&#60;br /&#62;
		if(function_exists('gform_get_meta')) {&#60;br /&#62;
	        $status_filter = $wpdb-&#38;gt;prepare(&#34; AND status=%s &#34;, 'active');&#60;br /&#62;
	    } else {&#60;br /&#62;
	    	$status_filter = '';&#60;br /&#62;
	    }&#60;br /&#62;
		$start_date_filter = empty($start_date) ? &#34;&#34; : &#34; AND datediff(date_created, '$start_date') &#38;gt;=0&#34;;&#60;br /&#62;
		$end_date_filter = empty($end_date) ? &#34;&#34; : &#34; AND datediff(date_created, '$end_date') &#38;lt;=0&#34;;&#60;/p&#62;
&#60;p&#62;		$search_term = &#34;%$search%&#34;;&#60;br /&#62;
		$search_filter = empty($search) ? &#34;&#34; : $wpdb-&#38;gt;prepare(&#34;AND ld.value LIKE %s&#34;, $search_term);&#60;/p&#62;
&#60;p&#62;		$user_filter = '';&#60;br /&#62;
		if($limituser) {&#60;br /&#62;
			get_currentuserinfo();&#60;br /&#62;
			if((int)$current_user-&#38;gt;ID !== 0 &#124;&#124; ($current_user-&#38;gt;ID === 0 &#38;amp;&#38;amp; apply_filters('kws_gf_show_entries_if_not_logged_in', apply_filters('kws_gf_treat_not_logged_in_as_user', true)))) {&#60;br /&#62;
				if(!empty($current_user-&#38;gt;ID)) {&#60;br /&#62;
	        		$user_filter = $wpdb-&#38;gt;prepare(&#34; AND l.created_by=%d &#34;, $current_user-&#38;gt;ID);&#60;br /&#62;
	        	} else {&#60;br /&#62;
	        		$user_filter = $wpdb-&#38;gt;prepare(&#34; AND (created_by IS NULL OR created_by=%d)&#34;, $current_user-&#38;gt;ID);&#60;br /&#62;
	        	}&#60;br /&#62;
			} else {&#60;br /&#62;
				return false;&#60;br /&#62;
			}&#60;/p&#62;
&#60;p&#62;		}&#60;/p&#62;
&#60;p&#62;		$in_filter = &#34;&#34;;&#60;br /&#62;
		if($approved) {&#60;br /&#62;
			$in_filter = $wpdb-&#38;gt;prepare(&#34;l.id IN (SELECT lead_id from $detail_table_name WHERE field_number BETWEEN %f AND %f) AND&#34;, $column - 0.001, $column + 0.001);&#60;br /&#62;
			// This will work once all the fields are converted to the meta_key after 1.6&#60;br /&#62;
			#$search_filter .= $wpdb-&#38;gt;prepare(&#34; AND m.meta_key = 'is_approved' AND m.meta_value = %s&#34;, 1);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;		$sql = &#34;SELECT count(distinct l.id) FROM $lead_table_name as l,&#60;br /&#62;
				$detail_table_name as ld&#34;;&#60;br /&#62;
#		$sql .= function_exists('gform_get_meta') ? &#34; INNER JOIN wp_rg_lead_meta m ON l.id = m.lead_id &#34; : &#34;&#34;; // After 1.6&#60;br /&#62;
		$sql .= &#34;&#60;br /&#62;
				WHERE $in_filter&#60;br /&#62;
				l.form_id=$form_id&#60;br /&#62;
				AND ld.form_id=$form_id&#60;br /&#62;
				AND l.id = ld.lead_id&#60;br /&#62;
				$star_filter&#60;br /&#62;
				$read_filter&#60;br /&#62;
				$status_filter&#60;br /&#62;
				$user_filter&#60;br /&#62;
				$start_date_filter&#60;br /&#62;
				$end_date_filter&#60;br /&#62;
				$search_filter&#34;;&#60;/p&#62;
&#60;p&#62;		return $wpdb-&#38;gt;get_var($sql);&#60;br /&#62;
	}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>boodcode on "count of approved entries with get_lead_count ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/count-of-approved-entries-with-get_lead_count#post-67864</link>
			<pubDate>Wed, 25 Jul 2012 10:27:30 +0000</pubDate>
			<dc:creator>boodcode</dc:creator>
			<guid isPermaLink="false">67864@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;when you install gravity forms addons, you'll get a function 'get_lead_count' that is defined in the gravity-forms-addons.php:&#60;br /&#62;
function get_lead_count($form_id, $search, $star=null, $read=null, $column, $approved = false, $leads = array(), $start_date = null, $end_date = null, $limituser = false){.....}&#60;/p&#62;
&#60;p&#62;with GF addons you can approve or not an entries to show or not it in your website.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "count of approved entries with get_lead_count ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/count-of-approved-entries-with-get_lead_count#post-67767</link>
			<pubDate>Tue, 24 Jul 2012 16:26:02 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">67767@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;What is an &#34;approved&#34; entry?  I'm familiar with read, unread, starred, maybe spam and trash.  What do you consider approved?  Is that an additional field you're added to your entries?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>boodcode on "count of approved entries with get_lead_count ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/count-of-approved-entries-with-get_lead_count#post-67728</link>
			<pubDate>Tue, 24 Jul 2012 11:17:33 +0000</pubDate>
			<dc:creator>boodcode</dc:creator>
			<guid isPermaLink="false">67728@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;How show count of just approved entries with get_lead_count ??&#60;br /&#62;
i tried this :&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$entry_count = RGFormsModel::get_lead_count(1, &#38;quot;&#38;quot;, null, null, null, null);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;but it's all the entries (approved and not approved)&#60;/p&#62;
&#60;p&#62;and if i try&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$entry_count = RGFormsModel::get_lead_count(1, &#38;quot;&#38;quot;, null, null, null, true);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;but it's return 0 entry&#60;/p&#62;
&#60;p&#62;what's the solution???
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
