<?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: pre-populating hidden form field problems.</title>
		<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems</link>
		<description>Gravity Support Forums Topic: pre-populating hidden form field problems.</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 02:56:51 +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/pre-populating-hidden-form-field-problems" rel="self" type="application/rss+xml" />

		<item>
			<title>Alex Cancado on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1270</link>
			<pubDate>Thu, 29 Oct 2009 23:27:54 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">1270@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Robert,&#60;br /&#62;
Based on your function, I don't see why it wouldn't return the correct value inside the filter. Is there any way you could give me temporary access to your WP admin so that I could take a closer look at it? If so, please email them to alex[at]rocketgenius.com.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RobertLBasil on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1268</link>
			<pubDate>Thu, 29 Oct 2009 17:22:09 +0000</pubDate>
			<dc:creator>RobertLBasil</dc:creator>
			<guid isPermaLink="false">1268@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Caril,&#60;/p&#62;
&#60;p&#62;I'll just edit our our database URL info and post it below.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
/*
Plugin Name: Plexus Core
Plugin URI:
Description: Gather specific information from a Plexus database for use in browser cookies
Version: 2.0
Author: Robert Basil
Author URI: &#60;a href=&#34;http://www.plexusworldwideinc.com&#34; rel=&#34;nofollow&#34;&#62;http://www.plexusworldwideinc.com&#60;/a&#62;
*/

/*  Copyright 2009  Robert Basil  (email : &#60;a href=&#34;mailto:robert@plexusworldwide.com&#34;&#62;robert@plexusworldwide.com&#60;/a&#62;)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/*  This function is the core of the plug-in.  Place a call to this function at the top of your
 *	theme&#38;#39;s 404 page template (404.php).  Make sure the call is AFTER any headers are sent to
 *	avoid an error.
 */
function plexus_initialize() {
	$url = &#38;quot;http://&#38;quot; . $_SERVER[&#38;#39;SERVER_NAME&#38;#39;] . $_SERVER[&#38;#39;REQUEST_URI&#38;#39;];							//First we parse the URL requested
	$sPath = substr($url, -(strlen($url) - strlen(get_bloginfo(&#38;#39;url&#38;#39;)) - 1));						//Based on the URL requested and the known page URL, we now know the request

//	plexus_cookie($sPath);																			//This function will store whatever the user entered in the last part of the URL in
																									//a cookie called &#38;quot;plexus_data&#38;quot;
	$dataurl = &#38;quot;http://www.database-url-removed-for-security.com/plexus/err404.asp?site=&#38;quot; . $sPath;
setcookie(&#38;quot;tester&#38;quot;, $dataurl, time() + 36000);

	$datastring = file_post_contents($dataurl);
	plexus_populate($sPath, $datastring);
}

function plexus_populate($id, $everything) {
	$data = explode(&#38;quot;&#124;&#38;quot;, $everything);
	$dummy = $data[0];
	$agent = $data[1];
	$name = $data[2];
	$email = $data[3];
	$phone = $data[4];
	$photo = $data[6];

	if($agent != &#38;quot;Not Found&#38;quot;) {
		setcookie(&#38;quot;plexus_ID&#38;quot;, $id, time() + 36000);
		setcookie(&#38;quot;plexus_Extra&#38;quot;, $dummy, time()+36000);
		setcookie(&#38;quot;plexus_Agent&#38;quot;, $agent, time() + 36000);
		setcookie(&#38;quot;plexus_Name&#38;quot;, $name, time() + 36000);
		setcookie(&#38;quot;plexus_Email&#38;quot;, $email, time() + 36000);
		setcookie(&#38;quot;plexus_Phone&#38;quot;, $phone, time() + 36000);
		setcookie(&#38;quot;plexus_Photo&#38;quot;, $photo, time() + 36000);
	}
}

function plexus_shortcode($atts) {
	$atts = shortcode_atts(array(&#38;#39;var&#38;#39; =&#38;gt; &#38;#39;&#38;#39;), $atts);
	return get_plexus_information($atts[&#38;#39;var&#38;#39;]);
}

function get_plexus_information($info)
{
	switch(strtolower($info)) {
		case &#38;#39;id&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_ID&#38;#39;];
			break;
		case &#38;#39;agent&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_Agent&#38;#39;];
			break;
		case &#38;#39;name&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_Name&#38;#39;];
			break;
		case &#38;#39;email&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_Email&#38;#39;];
			break;
		case &#38;#39;phone&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_Phone&#38;#39;];
			break;
		case &#38;#39;photo&#38;#39;:
			return $_COOKIE[&#38;#39;plexus_Photo&#38;#39;];
			break;
		default:
			return false;
			break;
	}
}

/*  These functions will echo back the appropriate field from the cookie
 */
function plexus_information($info)
{
	echo get_plexus_information($info);
}
//add_shortcode(&#38;#39;plexus&#38;#39;, &#38;#39;plexus_shortcode&#38;#39;);
add_shortcode(&#38;#39;plexus&#38;#39;, &#38;#39;plexus_shortcode&#38;#39;);

/* Miscellaneous function to allow us to use PUT methods to retrieve information
 */
function file_post_contents($url,$head=false) {
    $url = parse_url($url);

    if (!isset($url[&#38;#39;port&#38;#39;])) {
      if ($url[&#38;#39;scheme&#38;#39;] == &#38;#39;http&#38;#39;) { $url[&#38;#39;port&#38;#39;]=80; }
      elseif ($url[&#38;#39;scheme&#38;#39;] == &#38;#39;https&#38;#39;) { $url[&#38;#39;port&#38;#39;]=443; }
    }
    $url[&#38;#39;query&#38;#39;]=isset($url[&#38;#39;query&#38;#39;])?$url[&#38;#39;query&#38;#39;]:&#38;#39;&#38;#39;;

    $url[&#38;#39;protocol&#38;#39;]=$url[&#38;#39;scheme&#38;#39;].&#38;#39;://&#38;#39;;
    $eol=&#38;quot;\r\n&#38;quot;;

    $headers =  &#38;quot;POST &#38;quot;.$url[&#38;#39;protocol&#38;#39;].$url[&#38;#39;host&#38;#39;].$url[&#38;#39;path&#38;#39;].&#38;quot; HTTP/1.0&#38;quot;.$eol.
                &#38;quot;Host: &#38;quot;.$url[&#38;#39;host&#38;#39;].$eol.
                &#38;quot;Referer: &#38;quot;.$url[&#38;#39;protocol&#38;#39;].$url[&#38;#39;host&#38;#39;].$url[&#38;#39;path&#38;#39;].$eol.
                &#38;quot;Content-Type: application/x-www-form-urlencoded&#38;quot;.$eol.
                &#38;quot;Content-Length: &#38;quot;.strlen($url[&#38;#39;query&#38;#39;]).$eol.
                $eol.$url[&#38;#39;query&#38;#39;];
    $fp = fsockopen($url[&#38;#39;host&#38;#39;], $url[&#38;#39;port&#38;#39;], $errno, $errstr, 30);
    if($fp) {
      fputs($fp, $headers);
      $result = &#38;#39;&#38;#39;;
      while(!feof($fp)) { $result .= fgets($fp, 128); }
      fclose($fp);
      if (!$head) {
        //removes headers
        $pattern=&#38;quot;/^.*\r\n\r\n/s&#38;quot;;
        $result=preg_replace($pattern,&#38;#39;&#38;#39;,$result);
      }
      return $result;
    }
} 

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1267</link>
			<pubDate>Thu, 29 Oct 2009 11:10:12 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">1267@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey Robert, can you email me the code that makes up the plexus_information PHP function so that we can take a look at it? There is something with how that function is utilized that is preventing it from working within the context of the filter.  &#60;/p&#62;
&#60;p&#62;If you can send us over the PHP code as an email attachment, we can take a look and see if we notice anything that can be changed so that it will work.  You can send it to carl -at- rocketgenius.com&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RobertLBasil on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1261</link>
			<pubDate>Wed, 28 Oct 2009 18:44:09 +0000</pubDate>
			<dc:creator>RobertLBasil</dc:creator>
			<guid isPermaLink="false">1261@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;It outputs a 5 digit agent id number. Only numeric digits.&#60;/p&#62;
&#60;p&#62;For example: 86740
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1260</link>
			<pubDate>Wed, 28 Oct 2009 18:39:27 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">1260@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;What exactly does that function output? Can you post an example of what that function call outputs here?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RobertLBasil on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1259</link>
			<pubDate>Wed, 28 Oct 2009 18:17:28 +0000</pubDate>
			<dc:creator>RobertLBasil</dc:creator>
			<guid isPermaLink="false">1259@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Carl,&#60;/p&#62;
&#60;p&#62;We call it on every singe page of our website and it's works fine. We use the php to place it in the sidebar &#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;lt;?php plexus_information(&#38;quot;agent&#38;quot;); ?&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and the shortcode to place it in certain pages.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;[plexus var=&#38;quot;agent&#38;quot; /]&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1258</link>
			<pubDate>Wed, 28 Oct 2009 18:11:41 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">1258@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If it is populating the field that means the filter is working as intended and the issue has to do with the function you are trying to call as the value. Double check that your plexus_information(&#34;agent&#34;) is in fact returning a value, try calling it in your theme somewhere by itself and see if it outputs the expected value on the page.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RobertLBasil on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1257</link>
			<pubDate>Wed, 28 Oct 2009 18:05:18 +0000</pubDate>
			<dc:creator>RobertLBasil</dc:creator>
			<guid isPermaLink="false">1257@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Carl,&#60;/p&#62;
&#60;p&#62;Yup, that put &#34;Test&#34; in the field.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1256</link>
			<pubDate>Wed, 28 Oct 2009 17:57:52 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">1256@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello Robert,  Try this test code snippet which simply inserts a text value into the field and let me know if it works.  I just tested it on my test site by placing it in my themes functions.php file and it is pre-populating the field value as it should.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_value_agent&#38;quot;, &#38;quot;populate_agent&#38;quot;);
function populate_agent(){
$agent_value = &#38;quot;Test&#38;quot;;
return $agent_value;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I placed the above code snippet on my test site and you can see it pre-populate the value here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.carlhancock.com/test/&#34; rel=&#34;nofollow&#34;&#62;http://www.carlhancock.com/test/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You will see the textarea on that form has &#34;Test&#34; as the value, it is being pre-populated by the code snippet above.&#60;/p&#62;
&#60;p&#62;Try this test snippet to see if it does the same for you so we can then determine why your original code didn't populate the field value.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RobertLBasil on "pre-populating hidden form field problems."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pre-populating-hidden-form-field-problems#post-1253</link>
			<pubDate>Wed, 28 Oct 2009 17:38:40 +0000</pubDate>
			<dc:creator>RobertLBasil</dc:creator>
			<guid isPermaLink="false">1253@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Carl,&#60;/p&#62;
&#60;p&#62;Nope, no BR line breaks in the code.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
