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)