Update private password login form
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 23 May 2017 17:03:07 +0000 (13:03 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 23 May 2017 17:03:07 +0000 (13:03 -0400)
Adding http referrer for https to http login page to work.

functions.php
style.css

index 71b92cc..59243a8 100644 (file)
@@ -402,4 +402,24 @@ function post_pw_sess_expire() {
         }
     }
 }
+/**
+ * Add a redirect field for password protect forms when
+ * HTTP_REFERER isn't set
+ *
+ * @access public
+ * @param string $form_html
+ * @return string
+ */
+public function wpa_add__wp_http_referer( $form_html ) {
+ if ( empty( $_SERVER['HTTP_REFERER'] ) ) {
+     $form_html = str_ireplace(
+         '</form>',
+         '<input type="hidden" name="_wp_http_referer" value="' . esc_url( get_the_permalink() ) . '"></form>',
+         $form_html
+     );
+ }
+
+ return $form_html;
+}
+add_filter( 'the_password_form', array( $this, 'wpa_add__wp_http_referer' ), 10, 1 );
 ?>
index ea069ba..0757bcc 100644 (file)
--- a/style.css
+++ b/style.css
@@ -3,5 +3,5 @@ Theme Name: GreatLakesShipwreckMuseum
 Author: Gaslight Media
 Author URI: http://www.gaslightmedia.com
 Description: A theme for GreatLakesShipwreckMuseum
-Version: 1.0.18
+Version: 1.0.19
 */