{"id":117,"date":"2008-08-06T08:14:26","date_gmt":"2008-08-06T13:14:26","guid":{"rendered":"http:\/\/stein.everybody.org\/brain\/?p=117"},"modified":"2011-03-10T10:57:27","modified_gmt":"2011-03-10T15:57:27","slug":"wordpress-auto-login","status":"publish","type":"post","link":"https:\/\/jeremystein.com\/brain\/wordpress-auto-login\/","title":{"rendered":"WordPress Auto-login"},"content":{"rendered":"<p>My family blog requires a log-in, but certain elderly relatives don&#8217;t understand how to enter a username and password into the log-in page.  So, instead I send them links like this: http:\/\/mysite.com\/l\/username\/password.  When they click the links, it logs them in with &#8220;Remember Me&#8221; selected.<\/p>\n<p>I added the following line to my .htaccess file:<\/p>\n<pre>\nRewriteRule ^l\/(.+)\/(.+)\/?$ \/auto-login.php?log=$1&pwd=$2 [QSA,L]\n<\/pre>\n<p>Then I created auto-login.php:<\/p>\n<pre>\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Family Notes&lt;\/title&gt;\n    &lt;script language=\"javascript\"&gt;\n      function send() {\n        document.loginform.submit();\n      }\n    &lt;\/script&gt;\n  &lt;\/head&gt;\n  &lt;body onload=\"send()\"&gt;\n    &lt;form name=\"loginform\" id=\"loginform\" action=\"\/wp-login.php\" method=\"post\"&gt;\n      &lt;input type=\"hidden\" name=\"log\" value=\"&lt;?php echo $_GET[\"log\"]; ?&gt;\"\/&gt;\n      &lt;input type=\"hidden\" name=\"pwd\" value=\"&lt;?php echo $_GET[\"pwd\"]; ?&gt;\"\/&gt;\n      &lt;input type=\"hidden\" name=\"rememberme\" value=\"forever\"\/&gt;\n      &lt;input type=\"hidden\" name=\"wp-submit\" value=\"Log In\"\/&gt;\n      &lt;input type=\"hidden\" name=\"redirect_to\" value=\"\/\"\/&gt;\n      &lt;input type=\"hidden\" name=\"testcookie\" value=\"1\"\/&gt;\n      &lt;noscript&gt;&lt;input type=\"submit\" name=\"ignore\" value=\"Log in\"\/&gt;&lt;\/noscript&gt;\n    &lt;\/form&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n<p>(The form input names are copied from wp-login.php.  You may want to check yours as it can change between releases.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My family blog requires a log-in, but certain elderly relatives don&#8217;t understand how to enter a username and password into the log-in page. So, instead I send them links like this: http:\/\/mysite.com\/l\/username\/password. When they click the links, it logs them in with &#8220;Remember Me&#8221; selected. I added the following line to my .htaccess file: RewriteRule [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-html"],"_links":{"self":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/comments?post=117"}],"version-history":[{"count":0,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/117\/revisions"}],"wp:attachment":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/media?parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/categories?post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/tags?post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}