Starting WIP for member only front end form.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 21 Oct 2016 13:03:57 +0000 (09:03 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 21 Oct 2016 13:03:57 +0000 (09:03 -0400)
This form could be used on the front end for member only. So they can
quickly add events.

models/front/events/frontAdd.php
setup/shortcodes.php
views/front/events/error.html [new file with mode: 0644]

index 81f58dd..0143a25 100644 (file)
@@ -116,6 +116,29 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
         $startTime      =
         $endTime        = 0;
         $status         = false;
+        $memberOnly     = false;
+
+        echo '<br style="clear: right;">';
+        echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
+
+        if ( isset( $actionData['request']['memberOnly'] )
+            && $memberOnly = filter_var( $actionData['request']['memberOnly'], FILTER_VALIDATE_BOOLEAN ) ) {
+
+            $config = apply_filters( 'glm_associate_config', '' );
+            $contact_user = ( isset( $config['loggedInUser']['contactUser'] ) ) ? $config['loggedInUser']['contactUser']: null;
+            if ( !$contact_user ) {
+
+                return array(
+                    'status'           => $status,
+                    'menuItemRedirect' => false,
+                    'modelRedirect'    => false,
+                    'view'             => 'front/events/error.html',
+                    'data'             => array(),
+                );
+            }
+            echo '<br style="clear: right;">';
+            echo '<pre>$contact_user: ' . print_r( $contact_user, true ) . '</pre>';
+        }
 
         if( ! wp_script_is( 'jquery-ui', 'enqueued' ) ){
             wp_enqueue_script('jquery-ui-datepicker', false, array('jquery'), false, true);
index fb08e65..be21c89 100644 (file)
@@ -105,7 +105,7 @@ $glmMembersEventsShortcodes = array(
             'template' => false,
             'limit'    => null,
             'featured' => null,
-            'current' => null,
+            'current'  => null,
         )
     ),
     'glm-members-event-detail' => array(
@@ -124,7 +124,8 @@ $glmMembersEventsShortcodes = array(
         'action'     => 'frontAdd',
         'table'      => false,
         'attributes' => array(
-            'id' => false
+            'id'         => false,
+            'memberOnly' => false,
         )
 
     ),
diff --git a/views/front/events/error.html b/views/front/events/error.html
new file mode 100644 (file)
index 0000000..55d0aba
--- /dev/null
@@ -0,0 +1,2 @@
+<h1>Error</h1>
+<p>There was an error</p>