Members only section changes
authorLaury GvR <laury@gaslightmedia.com>
Wed, 4 May 2016 13:32:21 +0000 (09:32 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 4 May 2016 13:32:21 +0000 (09:32 -0400)
css/app.css
functions.php
glm-members-only-template.php
lib/navigation.php
scss/_sidebar.scss

index 759541d..40213f1 100644 (file)
@@ -7548,7 +7548,7 @@ article {
 .current_page_item a {
   font-weight: bold; }
 
-.current {
+.sidebar .current {
   color: #57b649 !important; }
 
 .search-top #searchform {
index 52156df..dcaa7f8 100644 (file)
@@ -208,4 +208,42 @@ if (!function_exists('is_in_tree')) {
         return false;
     }
 }
-?>
+
+/**
+ * Function Name:   front_end_login_fail.
+ * Added for:       GLM Member DB front-end login failure custom redirection.
+ * Description:     This redirects the failed login to the custom login page 
+ *                  instead of default login page with a modified url
+**/
+add_action( 'wp_login_failed', 'front_end_login_fail' );
+function front_end_login_fail( $username ) {
+    // Getting URL of the login page
+    $referrer = $_SERVER['HTTP_REFERER'];    
+    // 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( get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=failed" ); 
+        exit;
+    }
+}
+
+/**
+ * Function Name:   front_end_blank_credentials.
+ * Added for:       GLM Member DB front-end login failure custom redirection.
+ * Description:     This redirects to the custom login page if user name or 
+ *                  password is empty with a modified url
+**/
+add_action( 'authenticate', 'front_end_blank_credentials', 1, 3);
+function front_end_blank_credentials( $login, $username, $password ) {
+
+    // Getting URL of the login page
+    $referrer = $_SERVER['HTTP_REFERER'];
+    // 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' ) ) { 
+        if( $username == "" || $password == "" ){
+            wp_redirect( get_permalink( get_option('glm_members_database_option_members_only_id') ) . "?login=empty" );
+            exit;
+        }
+    }
+}
+
+?>
\ No newline at end of file
index 20c907c..0b88d27 100644 (file)
@@ -16,7 +16,7 @@ Template Name: GLM Members Only Template
             <div class="small-12 large-8 columns right">
         <?php } ?>
                 <div class="row">
-                    <div id="main-content" class="small-12 columns">
+                    <div id="main-content" class="small-12 columns">         
                     <?php if (current_user_can("glm_members_login")) { ?>
                             <div id="glm-member-front-header" class="small-12 columns">
                                 <div class='glm-member-greeting'>Hello,     <?php $current_user = wp_get_current_user();echo $current_user->user_login ?>.</div>
@@ -25,16 +25,25 @@ Template Name: GLM Members Only Template
                                     <a class='button glm-button' href='<?php echo get_admin_url() ?>admin.php?page=glm-members-admin-menu-members'>Enter Member Admin Area</a>                        
                                 <?php } ?>
                             </div>
-                        <?php get_template_part('parts/bread-crumbs'); ?>
-                        
+                            <?php get_template_part('parts/bread-crumbs'); ?>
                             <?php if(have_posts()) : while(have_posts()): the_post();?>
-                            <?php the_content();?>
+                                <?php the_content();?>
                             <?php endwhile; else:?>
-                            <p><?php _e('Sorry, no results found.');?></p>
+                                <p><?php _e('Sorry, no results found.');?></p>
                             <?php endif;?>
-                        
                     <?php } else { ?>
-                            <p id="glm-member-login-notification">Please log in to gain access to this page</p>
+                            <div class="wp_login_error">
+                                <p id="glm-member-login-notification">
+                                <?php if( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) { ?>
+                                    The password you entered is incorrect, Please try again.
+                                <?php } 
+                                else if( isset( $_GET['login'] ) && $_GET['login'] == 'empty' ) { ?>
+                                    Please enter both username and password.
+                                <?php } else { ?>
+                                    Please log in to gain access to this page
+                                <?php } ?>
+                                </p>
+                            </div> 
                             <div id='glm-member-login-form'>
                             <?php wp_login_form(1, get_permalink()); ?>
                         </div>
index 69e299f..e75d0e2 100644 (file)
@@ -189,7 +189,7 @@ function glm_side_menu($mobile = false) {
     $sideMenu = $allMenu = $pageMenuId = array();
 //     do not use appearance menu for the following page ID's or their ancestors
     //if( !is_page(array(3200, 3201,3202,3203)) && !is_in_tree(3200) && !is_in_tree(3201) && !is_in_tree(3202) && !is_in_tree(3203)) {
-    if (is_in_tree(get_option('glm_members_database_members_only_id'))) { 
+    if (is_in_tree(get_option('glm_members_database_option_members_only_id'))) { 
         if (($locations = get_nav_menu_locations()) && isset($locations['members-only'])) {
             $menu       = wp_get_nav_menu_object($locations['members-only']);
         }
index 5e212e3..8292fbe 100644 (file)
 .current_page_item a {
     font-weight: bold;
 }
-.current{
+.sidebar .current {
     color: $green !important;
 }
\ No newline at end of file