<?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: Populate check boxes</title>
		<link>https://legacy.forums.gravityhelp.com/topic/populate-check-boxes</link>
		<description>Gravity Support Forums Topic: Populate check boxes</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 06:31:04 +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/populate-check-boxes" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Populate check boxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-check-boxes#post-105668</link>
			<pubDate>Sat, 22 Dec 2012 00:13:29 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">105668@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Do you have an example of the form online where we can see this functionality?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Effectiva on "Populate check boxes"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-check-boxes#post-103195</link>
			<pubDate>Sun, 16 Dec 2012 14:53:57 +0000</pubDate>
			<dc:creator>Effectiva</dc:creator>
			<guid isPermaLink="false">103195@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;When I try to populate checkboxes with these values: array( &#34;text&#34; =&#38;gt; get_the_title(), &#34;value&#34; =&#38;gt; get_the_ID(), &#34;isSelected&#34; =&#38;gt; '', &#34;price&#34; =&#38;gt; '' ); and there are less options in the Orginal form specified the checkboxes aren't processed? &#60;/p&#62;
&#60;p&#62;complete function:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;public function fill_combine_order_form($form){

		foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field) :

			/*
			*  Check boxes
			*
			*  Author Effectiva internet toepassingen
			*  @since 0.1
			*  @created: 8 november 2012
			*/

			if( $field[&#38;#39;inputName&#38;#39;] == &#38;#39;wp_combined_orders&#38;#39; ){

				// define values
				$this-&#38;gt;combine_order_checkbox_choices = &#38;#39;&#38;#39;;
				$this-&#38;gt;combine_order_checkbox_choices = array(); // empty for conflicts

				// check if user has &#38;#39;orders&#38;#39;
				$query_args = array(
					&#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;orders&#38;#39;,
					&#38;#39;meta_query&#38;#39; =&#38;gt; array(
					   array(
						   &#38;#39;key&#38;#39; =&#38;gt; &#38;#39;user&#38;#39;,
						   &#38;#39;value&#38;#39; =&#38;gt; $_SESSION[&#38;#39;user_id&#38;#39;],
						   &#38;#39;compare&#38;#39; =&#38;gt; &#38;#39;=&#38;#39;,
					   ),
					   array(
						   &#38;#39;key&#38;#39; =&#38;gt; &#38;#39;status&#38;#39;,
						   &#38;#39;value&#38;#39; =&#38;gt; array( 2,3,4 ),
						   &#38;#39;compare&#38;#39; =&#38;gt; &#38;#39;IN&#38;#39;,
					   )
				   	),
					&#38;#39;post_status&#38;#39; =&#38;gt; &#38;#39;publish&#38;#39;
				);	

				$orders_query = new WP_Query( $query_args );

				if( $orders_query-&#38;gt;found_posts &#38;gt;= 1 ){

					while ( $orders_query-&#38;gt;have_posts() ) : $orders_query-&#38;gt;the_post();

						$this-&#38;gt;combine_order_checkbox_choices[] = array( &#38;quot;text&#38;quot; =&#38;gt; get_the_title(), &#38;quot;value&#38;quot; =&#38;gt; get_the_ID(), &#38;quot;isSelected&#38;quot; =&#38;gt; &#38;#39;&#38;#39;, &#38;quot;price&#38;quot; =&#38;gt; &#38;#39;&#38;#39; );													

					endwhile;
				}
				else {
					$field[&#38;#39;type&#38;#39;] = &#38;#39;html&#38;#39;;
					$field[&#38;#39;content&#38;#39;] = &#38;#39;0 orders found&#38;#39;;
				}

				$field[&#38;#39;choices&#38;#39;] = $this-&#38;gt;combine_order_checkbox_choices;

				//$field[&#38;#39;choices&#38;#39;] = $choices;
				//add_filter(&#38;quot;gform_field_value_wp_combined_orders&#38;quot;, &#38;quot;populate_checkbox&#38;quot;);

			}		

		endforeach;

		$this-&#38;gt;form = $form;
	}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
