<?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: Form Direct to Private Page with Auto Login</title>
		<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login</link>
		<description>Gravity Support Forums Topic: Form Direct to Private Page with Auto Login</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 03:05:43 +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/form-direct-to-private-page-with-auto-login" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-103554</link>
			<pubDate>Mon, 17 Dec 2012 13:28:56 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">103554@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks for the update Louise.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-101261</link>
			<pubDate>Tue, 11 Dec 2012 11:54:35 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">101261@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Chris, absolutely the best!  I was able to get the form to work as I needed and I also added a new user role in the functions.php, just for this registration form.&#60;/p&#62;
&#60;p&#62;I also added a simple plugin, so that once a user was logged in they could not see or change the password.  Making it possible to keep them from logging back in later or giving their login details to a friend.&#60;/p&#62;
&#60;p&#62;Works great.&#60;/p&#62;
&#60;p&#62;Thanks so much - Happy Holidays.&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-101071</link>
			<pubDate>Tue, 11 Dec 2012 00:24:44 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">101071@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Finally, I was able to use this code to log the user in after registering with the User Registration add-on:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
add_action(&#38;#39;gform_user_registered&#38;#39;, &#38;#39;gf_autologin&#38;#39;, 10, 4);
function gf_autologin($user_id, $config, $entry, $password) {
    wp_set_auth_cookie($user_id, false, &#38;#39;&#38;#39;);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;a href=&#34;http://pastebin.com/HNTWhPSr&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/HNTWhPSr&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-101070</link>
			<pubDate>Tue, 11 Dec 2012 00:22:35 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">101070@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;One problem I found when debugging this: make sure the role you are assigning to your registered users has sufficient capabilities to see private posts or pages.  There are two specific capabilities built in to WordPress:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;read_private_pages
read_private_posts&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;If you are registering users and you want to log them in and have them see a private page or post, be sure that role you are assigning them has permission to view protected content.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-101068</link>
			<pubDate>Tue, 11 Dec 2012 00:17:03 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">101068@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Louise, are you using the Gravity Forms User Registration Add-on to register your users?  I did not see it installed on your site.  The gform_user_registered action will only be available if you are using the User Registration Add-on.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-97589</link>
			<pubDate>Sat, 01 Dec 2012 02:53:03 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">97589@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yes, I can look at the form online if you like.  Please send the URL to &#60;a href=&#34;mailto:chris@rocketgenius.com&#34;&#62;chris@rocketgenius.com&#60;/a&#62; and reference this topic.  If you think I need it, please also send a WordPress administrator login.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-97328</link>
			<pubDate>Fri, 30 Nov 2012 12:48:26 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">97328@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Chris, I get a 404 page when I'm not logged in already and submit the form.&#60;br /&#62;
I did not see any debugging code anywhere.  Is this something if I send you the URL, you would look at?&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-96002</link>
			<pubDate>Tue, 27 Nov 2012 03:04:26 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">96002@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;When do you get a 404 error page?&#60;/p&#62;
&#60;p&#62;The debug output should be shown on screen; sometimes in the source of the page, but normally right in the browser.  It's normally a big mess.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-95842</link>
			<pubDate>Mon, 26 Nov 2012 16:03:32 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">95842@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Chris,&#60;/p&#62;
&#60;p&#62;I tried what you suggested:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
	if(5 == $entry[&#38;#39;form_id&#38;#39;]) {
	$user = get_userdata( $user_id );
	$user_login = $user-&#38;gt;user_login;
	$user_password = $password;

	$user = wp_signon( array(
		&#38;#39;user_login&#38;#39; =&#38;gt; &#38;#39;freeitem&#38;#39;,
		&#38;#39;user_password&#38;#39; =&#38;gt;  &#38;#39;samplepassword&#38;#39;,
		&#38;#39;remember&#38;#39; =&#38;gt; false
    ) );
// see what $user contains, as a debugging step
var_dump($user);
// or, check for an error
if ( is_wp_error($user) )
   echo $user-&#38;gt;get_error_message();

    }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;All that was returned, was the 404 error page not found.  When I'm already logged in, I am directed to the private page.&#60;/p&#62;
&#60;p&#62;I added the debug code, but I'm not really sure where I should be seeing this.&#60;/p&#62;
&#60;p&#62;I appreciate any help.&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Form Direct to Private Page with Auto Login"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/form-direct-to-private-page-with-auto-login#post-92230</link>
			<pubDate>Sat, 17 Nov 2012 03:06:16 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">92230@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;What happened when you tried that code?  Did you customize it at all, or just try that as is?&#60;/p&#62;
&#60;p&#62;To make this apply to just one form, you can do something like this between existing lines 5 and 6:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
if(117 == $entry[&#38;#39;form_id]( {&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;And then close that conditional between lines 14 and 15.  That would make the code run only for entries submitted via form 117.  Change that form ID to your own form ID.&#60;/p&#62;
&#60;p&#62;To debug your sign on function, I would assign the object returned by wp_signon to a variable, then check that for errors.  Something like this (change line 10 and then add to it):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$user = wp_signon( array(
		&#38;#39;user_login&#38;#39; =&#38;gt; &#38;#39;freeitem&#38;#39;,
		&#38;#39;user_password&#38;#39; =&#38;gt;  &#38;#39;samplepassword&#38;#39;,
		&#38;#39;remember&#38;#39; =&#38;gt; false
    ) );
// see what $user contains, as a debugging step
var_dump($user);
// or, check for an error
if ( is_wp_error($user) )
   echo $user-&#38;gt;get_error_message();&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
