Testing out a better logout link for the WooCommerce top bar
authorLaury GvR <laury@gaslightmedia.com>
Tue, 1 Nov 2016 17:37:22 +0000 (13:37 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 1 Nov 2016 17:37:22 +0000 (13:37 -0400)
woocommerce.php

index f3b1931..9145a2a 100644 (file)
                                 </div>
                                 <div id="woo-quick-checkout" class="small-4 columns right">
                                     <?php
-                                        $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
-                                        if ( $myaccount_page_id ) {
-                                            $myaccount_page_url = get_permalink( $myaccount_page_id );
-                                        }
-                                        if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
-                                            $myaccount_page_url = str_replace( 'http:', 'https:', $myaccount_page_id );
-                                        } else {
-                                            $myaccount_page_url = str_replace( 'https:', 'http:', $myaccount_page_id );
-                                        }
-                                        
-                                        if ( $myaccount_page_id ) {
-
-                                          $logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );
-
-                                          if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' )
-                                            $logout_url = str_replace( 'http:', 'https:', $logout_url );
-                                        }
-                                        
                                         if (is_user_logged_in()) { 
-                                            echo '<a href="'. $logout_url . '" class="button login_toggle">log out</a>';
+                                            echo '<a href="'. get_permalink($myaccount_page_id) . '?customer-logout=true" class="button login_toggle">log out</a>';
                                         }
                                         elseif (!is_user_logged_in()) {
-                                            echo '<a href="'. $myaccount_page_url . '" class="button login_toggle">log in</a>';
+                                            echo '<a href="'. get_permalink( $myaccount_page_id ) . '" class="button login_toggle">log in</a>';
                                         }
                                     ?>
+                                    <?php
+                                    
+//                                        $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
+//                                        if ( $myaccount_page_id ) {
+//                                            $myaccount_page_url = get_permalink( $myaccount_page_id );
+//                                        }
+//                                        if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
+//                                            $myaccount_page_url = str_replace( 'http:', 'https:', $myaccount_page_id );
+//                                        } else {
+//                                            $myaccount_page_url = str_replace( 'https:', 'http:', $myaccount_page_id );
+//                                        }
+//                                        
+// 
+//                                        if ( $myaccount_page_id ) {
+//
+//                                          $logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );
+//
+//                                          if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' )
+//                                            $logout_url = str_replace( 'http:', 'https:', $logout_url );
+//                                        }
+//                                        
+//                                        if (is_user_logged_in()) { 
+//                                            echo '<a href="'. $logout_url . '" class="button login_toggle">log out</a>';
+//                                        }
+//                                        elseif (!is_user_logged_in()) {
+//                                            echo '<a href="'. $myaccount_page_url . '" class="button login_toggle">log in</a>';
+//                                        }
+                                    ?>
                                     <a href="<?php echo $woocommerce->cart->get_checkout_url(); ?>" class="button">checkout</a>
                                 </div>
                             </div>