<?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: All Users of a Role Register for Primary Site (multisite)</title>
		<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite</link>
		<description>Gravity Support Forums Topic: All Users of a Role Register for Primary Site (multisite)</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 06:53:52 +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/all-users-of-a-role-register-for-primary-site-multisite" rel="self" type="application/rss+xml" />

		<item>
			<title>David Peralty on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66190</link>
			<pubDate>Fri, 13 Jul 2012 17:32:26 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">66190@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks for taking the time to post this. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ktrusak on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66185</link>
			<pubDate>Fri, 13 Jul 2012 17:18:42 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">66185@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;SOLUTION: Below is the solution to this problem. If you would like an automatic redirect to the previous page, here is the code to help you out. A very special thanks to David Peralty for this solution.&#60;/p&#62;
&#60;p&#62;Insert this code into your functions.php file&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_confirmation&#38;quot;, &#38;quot;custom_confirmation&#38;quot;, 10, 4);

function custom_confirmation($confirmation, $form, $lead, $ajax){
// replace with the input number of the hidden field
$redirurl = $_POST[&#38;quot;input_2&#38;quot;];

    if($form[&#38;quot;id&#38;quot;] == &#38;quot;1&#38;quot;){
	$confirmation = array();
	$confirmation[&#38;#39;redirect&#38;#39;] = $redirurl;
    }
    return $confirmation;
}

add_filter(&#38;quot;gform_pre_render_1&#38;quot;, &#38;quot;redirecturl&#38;quot;);
add_filter(&#38;quot;gform_admin_pre_render_1&#38;quot;, &#38;quot;redirecturl&#38;quot;);

function redirecturl($form){
 foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field){
	if($field[&#38;quot;id&#38;quot;] == 2){
		$field[&#38;quot;defaultValue&#38;quot;] = $_SERVER[&#38;#39;HTTP_REFERER&#38;#39;];
	}
 }
 return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Three important points:&#60;br /&#62;
--Where you see the number 1 is where you will need to fill in the form ID for the form you wish to apply the redirect&#60;br /&#62;
--Add a blank text box to your form, the ID of this box is the number you insert where you see the number 2. This text box is where the form will store your redirect url for after submission&#60;br /&#62;
--It is important to A) set that field to be dynamically populated (leave it blank though) and to B) hide it using CSS (add a class to form then add a line like .formclass {display: none;} to your css stylesheet)-DO NOT set it to be visible by admin only, it will not work if you do that.&#60;/p&#62;
&#60;p&#62;This works great for combining the User Registration add-on and setting forms to &#34;user must be logged in&#34;--place a link to a user registration form in the error message with this enabled and users will be redirected right back to the form after registering (there is also code on this forum for auto-login that really completes the process).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66176</link>
			<pubDate>Fri, 13 Jul 2012 16:04:53 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">66176@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you e-mail me an admin login... we are so close that I would like to tweak it and test it as I go to try to get this solved for you today.&#60;/p&#62;
&#60;p&#62;My e-mail is &#60;a href=&#34;mailto:peralty@rocketgenius.com&#34;&#62;peralty@rocketgenius.com&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ktrusak on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66172</link>
			<pubDate>Fri, 13 Jul 2012 15:44:06 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">66172@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am still getting the same result with the word 'array' printed. I posted my exact code from my functions.php file here: &#60;a href=&#34;http://pastebin.com/v4wR10AE&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/v4wR10AE&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66171</link>
			<pubDate>Fri, 13 Jul 2012 15:35:57 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">66171@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Your code to add the value to the hidden field should look something like the following:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_pre_render_3&#38;quot;, &#38;quot;redirecturl&#38;quot;);
add_filter(&#38;quot;gform_admin_pre_render_3&#38;quot;, &#38;quot;redirecturl&#38;quot;);

function redirecturl($form){
 foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field){
	if($field[&#38;quot;id&#38;quot;] == 8){
		$field[&#38;quot;defaultValue&#38;quot;] = $_SERVER[&#38;#39;HTTP_REFERER&#38;#39;];
	}
 }
 return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>ktrusak on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66170</link>
			<pubDate>Fri, 13 Jul 2012 15:22:15 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">66170@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;All that was outputted was the word 'array' printed in place of the form...&#60;/p&#62;
&#60;p&#62;I put $_SERVER['HTTP_REFERER']; (also tried $_SERVER['HTTP_REFERER']) as a default value in a single line text box that was hidden..
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66168</link>
			<pubDate>Fri, 13 Jul 2012 15:11:18 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">66168@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Sorry, forgot the semicolon. $redirurl = $_POST[&#34;input_8&#34;]; &#60;/p&#62;
&#60;p&#62;You will have to edit it via FTP or whatnot... because WordPress doesn't handle syntax errors well.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ktrusak on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66166</link>
			<pubDate>Fri, 13 Jul 2012 15:05:21 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">66166@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Okay, I think I get it-- I added a ';' after the post input line btw.&#60;/p&#62;
&#60;p&#62;All that returned was the word &#34;array&#34; printed? No redirect or anything
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66162</link>
			<pubDate>Fri, 13 Jul 2012 14:42:25 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">66162@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Okay, I have figured it out with the help of one of our developers. You need to take the value of the $_SERVER['HTTP_REFERER']; and put it in a hidden field. Then your redirect code becomes:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_confirmation&#38;quot;, &#38;quot;custom_confirmation&#38;quot;, 10, 4);

function custom_confirmation($confirmation, $form, $lead, $ajax){
// replace with the input number of the hidden field
$redirurl = $_POST[&#38;quot;input_8&#38;quot;]

    if($form[&#38;quot;id&#38;quot;] == &#38;quot;3&#38;quot;){
	$confirmation = array();
	$confirmation[&#38;#39;redirect&#38;#39;] = $redirurl;
    }
    return $confirmation;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>ktrusak on "All Users of a Role Register for Primary Site (multisite)"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/all-users-of-a-role-register-for-primary-site-multisite#post-66160</link>
			<pubDate>Fri, 13 Jul 2012 14:24:47 +0000</pubDate>
			<dc:creator>ktrusak</dc:creator>
			<guid isPermaLink="false">66160@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I was getting the same result I think. Okay sounds good, hopefully they could clear it up.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
