releasing changes to the login menu for failed login redirection
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 12 Nov 2018 19:15:57 +0000 (14:15 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 12 Nov 2018 19:15:57 +0000 (14:15 -0500)
functions.php
inc/glm-dev.php
js/custom.js
style.css

index 7558b43..562f7a7 100644 (file)
@@ -187,11 +187,11 @@ function accesspress_parallax_scripts() {
        wp_enqueue_script( 'jquery-fitvid', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), '1.0', true );
        wp_enqueue_script( 'nivo-lightbox', get_template_directory_uri() . '/js/nivo-lightbox.min.js', array('jquery'), '1.2.0', true );
        wp_enqueue_script( 'slick', get_template_directory_uri() . '/js/slick.js', array('jquery'), '1.8.0', true );
-       wp_enqueue_script( 'accesspress-parallax-custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0', true );
+       wp_enqueue_script( 'accesspress-parallax-custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.2', true );
     wp_localize_script( 'accesspress-parallax-custom', 'ap_params', $slider_parameters );
     
-    wp_enqueue_script( 'glm-dev', get_template_directory_uri() . '/assets/js/glm-dev.js', array(), '1.0.1', true );
-       wp_enqueue_style( 'glm-style', get_template_directory_uri() . '/assets/css/glm-dev.css', false, "1.0.1" );
+    wp_enqueue_script( 'glm-dev', get_template_directory_uri() . '/assets/js/glm-dev.js', array(), '1.0.2', true );
+       wp_enqueue_style( 'glm-style', get_template_directory_uri() . '/assets/css/glm-dev.css', false, "1.0.2" );
 
        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
                wp_enqueue_script( 'comment-reply' );
index e15cfc5..d38398f 100644 (file)
@@ -9,6 +9,16 @@ if( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) { ?>
 
 function glm_login_form( $atts ){
     ob_start(); ?>
+    <div class="wp_login_error">
+        <p id="glm-member-login-notification">
+            <?php if( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) { ?>
+                The information you entered is incorrect. Please try again.
+            <?php }
+                else if( isset( $_GET['login'] ) && $_GET['login'] == 'empty' ) { ?>
+                Please enter both username and password.
+            <?php } ?>
+        </p>
+    </div>
     <div id='glm-member-login-form'>
         <?php
             $args = array(
@@ -60,5 +70,13 @@ function validate_code( $validation_result ) {
     //Assign modified $form object back to the validation result
     $validation_result['form'] = $form;
     return $validation_result;
-
+}
+add_action( 'wp_login_failed', 'login_fail' );  // hook failed login
+function login_fail( $username ) {
+     $referrer = $_SERVER['HTTP_REFERER'];  // where did the post submission come from?
+     // if there's a valid referrer, and it's not the default log-in screen
+     if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
+          wp_redirect(home_url() . '/?login=failed' );  // let's append some information (login=failed) to the URL for the theme to use
+          exit;
+     }
 }
\ No newline at end of file
index bd94251..dcf3771 100644 (file)
@@ -240,4 +240,7 @@ jQuery(document).ready(function($){
     // login_section.on("click", function(){
     //     $("#modal-login").toggleClass("show-login");
     // })
+    if(window.location.href.indexOf("login=failed") > -1) {
+        $(".menu-login").trigger("click");
+     }
 });
\ No newline at end of file
index c278ade..d5698d3 100644 (file)
--- a/style.css
+++ b/style.css
@@ -2754,3 +2754,6 @@ body .cmvl-navbar-navigation span{
         width: 35%;
      }
 }
+#glm-member-login-notification{
+    color: red;
+}
\ No newline at end of file