The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] - Only show page on menu if logged in
#4
get_navigation_customget_navigation


(2016-01-12, 14:55:48)jwzumwalt Wrote: How can I make a page only show on the menu if the user is logged in?
Quote:[NOT POSSIBLE] - Only show page on menu if logged in
Why not possible? A lot of things possible with GetSimple. Smile
1. Create private page and add it to menu;
2. Paste this function into your website template functions.php file;
3. Use get_navigation_custom instead standart get_navigation function.

PHP Code:
function get_navigation_custom($currentpage,$classPrefix "") {

 
 $menu '';

 
 global $pagesArray;
 
 
  $pagesSorted 
subval_sort($pagesArray,'menuOrder');
 
 if (count($pagesSorted) != 0) { 
 
   foreach ($pagesSorted as $page) {
 
     $sel ''$classes '';
 
     $url_nav $page['url'];
 
     
      if 
($page['menuStatus'] == 'Y') {
 
       if ($page['private'] != 'Y' || is_logged_in()) {
 
         $parentClass = !empty($page['parent']) ? $classPrefix.$page['parent'] . " " "";
 
         $classes trim$parentClass.$classPrefix.$url_nav);
 
         if ("$currentpage== "$url_nav"$classes .= " current active";
 
         if ($page['menu'] == '') { $page['menu'] = $page['title']; }
 
         if ($page['title'] == '') { $page['title'] = $page['menu']; }
 
         $menu .= '<li class="'$classes .'"><a href="'find_url($page['url'],$page['parent']) . '" title="'encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></li>'."\n";
 
       }
 
     }
 
   }
 
   
  
}
 
 
  echo exec_filter
('menuitems',$menu);

Reply


Messages In This Thread
RE: Only show page if logged in - by Frens - 2016-01-13, 04:40:45
RE: Only show page if logged in - by shawn_a - 2016-01-13, 04:42:43
RE: [NOT POSSIBLE] - Only show page on menu if logged in - by DimaYakovlev - 2016-01-18, 07:04:36



Users browsing this thread: 1 Guest(s)