Member link in template only if page is on
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 19 Aug 2014 14:59:49 +0000 (10:59 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 19 Aug 2014 14:59:49 +0000 (10:59 -0400)
Setup template so the members link in footer only appears if the member
login page is active.

Toolkit/Page.php
templates/template.html

index ef6437c..6c54853 100755 (executable)
@@ -441,6 +441,17 @@ class Toolkit_Page
             ) {
                 header('Location: ' . $this->getToolboxUrl(MEMBERS_CATEGORY));
             }
+            if (filter_var(MEMBERS_CATEGORY, FILTER_VALIDATE_INT)) {
+                $dbh = Toolkit_Database::getInstance();
+                $sql = "
+                SELECT active
+                  FROM toolbox.pages
+                 WHERE id = " . MEMBERS_CATEGORY;
+                $this->hasMembersOnly = (bool)$dbh->query($sql)->fetchColumn();
+            }
+
+        } else {
+            $this->hasMembersOnly = false;
         }
         $this->pageTitle = $this->_getPageTitle($this->_catid);
 
index 0755f07..4554fb5 100644 (file)
                 <ul class="small-12 columns">
                   <li class="separator">&copy; <?php echo date('Y');?> Keweenaw Convention &amp; Visitor&apos;s Bureau</li>
                   <li class="separator">Produced by <a href="http://www.gaslightmedia.com" target="_blank">Gaslight Media</a></li>
-                  <li class="separator"><a href="{mediaBaseURL:h}members-only-area/">Members</a></li>
+                  <li class="separator" flexy:if="hasMembersOnly"><a href="{mediaBaseURL:h}members-only-area/">Members</a></li>
                   <li><a href="{mediaBaseURL:h}site-map">Site Map</a></li>
                 </ul>
               </div>