Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] - Only show page on menu if logged in
#13
jwzumwalt, you can try another way, with using Shawns plugin sa hook components.

For simplicity, I combined all code into one component. But you can split it into to two components - one for frontend, another for backend.
PHP Code:
<?php
global $GSADMIN;
global 
$id;
global 
$url;
if (
is_frontend()) {
 
 if ($url == '404' && $id != $url && is_logged_in()) {
 
   $url get_site_url(false) . $GSADMIN '/edit.php?newpagefrom404=' urlencode($id);
 
   echo '<a href="' $url '">Create page</a>';
 
 }
} else {
 
 if (basename($_SERVER['PHP_SELF']) == 'edit.php') {
 
   if (!$url && isset($_GET['newpagefrom404'])) {
 
     $url $_GET['newpagefrom404'];
 
   }
 
 }
}
?>
How to use:
1. Install sa hook components plugin;
2. Create new component with name hook_admin-pre-header and paste into it given PHP code;
3. Call created component from your template or from another component. For example place this code in the default sidebar component:
PHP Code:
<?php get_component('hook_admin-pre-header'); ?>
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: [SOLVED] - Only show page on menu if logged in - by DimaYakovlev - 2016-01-19, 23:46:52



Users browsing this thread: 1 Guest(s)