Update for page redirects
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Oct 2017 14:00:38 +0000 (10:00 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Oct 2017 14:00:38 +0000 (10:00 -0400)
Use the built in way to redirect to main page.

css/front.css
models/front/registrations/index.php
models/front/registrations/login.php
models/front/registrations/register.php

index 9226510..2d5197c 100644 (file)
@@ -277,3 +277,14 @@ span.glm-error {
 .glm-reg-warning {
     color: red;
 }
+
+/* Checkout Form */
+.glm-reg-checkout .glm-form-input {
+    width: 46%;
+    margin-right: 1rem;
+    float: left;
+}
+.glm-reg-checkout div {
+    width: 100%;
+    float: none;
+}
index 2f98255..2f6753b 100644 (file)
@@ -81,7 +81,7 @@ class GlmMembersFront_registrations_index
     {
 
         // Check for valid page - if not valid default to "list"
-        $page = $actionData['request']['page'];
+        $page = (isset($actionData['request']['page']) ? $actionData['request']['page']: 'list');
 
         if ( isset( $_REQUEST['page'] ) && $request = filter_var( $_REQUEST['page'], FILTER_SANITIZE_STRING ) ) {
             $page = $request;
index 3a72794..9e53638 100644 (file)
@@ -40,6 +40,7 @@
     {
         $view    = 'login';
         $message = '';
+        $modelRedirect = false;
 
         // Check for $option
         $option = ( isset( $_REQUEST['option'] ) ) ? filter_var( $_REQUEST['option'], FILTER_SANITIZE_STRING) : null;
@@ -49,7 +50,8 @@
                 $_SESSION['LoginAccount'],
                 $_SESSION['glm_reg_cart_id']
             );
-            wp_redirect( GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/' );
+            $modelRedirect = 'index';
+            $_REQUEST['page'] = 'list';
             break;
         case 'submit':
             // check for password and email match
@@ -76,7 +78,8 @@
                     'fname' => $returnData['fname'],
                     'lname' => $returnData['lname'],
                 );
-                wp_redirect( GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/' );
+                $modelRedirect = 'index';
+                $_REQUEST['page'] = 'list';
             } else {
                 $message = 'Login Fail!';
             }
 
         // Compile template data
         $templateData = array(
+            'page'     => 'login',
             'message'  => $message,
             'regUrl'   => GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/',
             'loggedIn' => ( isset( $_SESSION['LoginAccount'] ) ) ? $_SESSION['LoginAccount']: false,
         );
-             // Return status, any suggested view, and any data to controller
+
+        // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
-            'modelRedirect' => false,
+            'modelRedirect' => $modelRedirect,
             'view'          => 'front/registrations/' . $view . '.html',
             'data'          => $templateData
         );
index f29eb4f..479af59 100644 (file)
@@ -38,8 +38,9 @@
 
     public function modelAction($actionData = false)
     {
-        $view       = 'register';
-        $emailError = '';
+        $view          = 'register';
+        $emailError    = '';
+        $modelRedirect = false;
 
         // Create dummy reg array $reg for the template data.
         $reg = array(
                     'lname' => $lname,
                 );
                 // Redirect to the start of registrations.
-                wp_redirect( GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/' );
+                $modelRedirect = 'index';
+                $_REQUEST['page'] = 'list';
             }
             break;
         default:
              // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
-            'modelRedirect' => false,
+            'modelRedirect' => $modelRedirect,
             'view'          => 'front/registrations/' . $view . '.html',
             'data'          => $templateData
         );