[SOLVED] - Only show page on menu if logged in - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11) +--- Thread: [SOLVED] - Only show page on menu if logged in (/showthread.php?tid=7826) |
[SOLVED] - Only show page on menu if logged in - jwzumwalt - 2016-01-12 How can I make a page only show on the menu if the user is logged in? RE: Only show page if logged in - Frens - 2016-01-13 (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? Look here http://get-simple.info/wiki/how_to:page_editing Search Create a New Page and look at Page Options RE: Only show page if logged in - shawn_a - 2016-01-13 Private pages are not filtered automatically in menus, you have to write your own menu functions. It only controls its visibility /access RE: [NOT POSSIBLE] - Only show page on menu if logged in - DimaYakovlev - 2016-01-18 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 inWhy not possible? A lot of things possible with GetSimple. 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 = "") { RE: [NOT POSSIBLE] - Only show page on menu if logged in - jwzumwalt - 2016-01-18 (2016-01-18, 07:04:36)DimaYakovlev Wrote: get_navigation_customget_navigation Wow! Thanks, you are really talented... Now if you feel like helping on something else, I would like to have a button show up on a "404 page not found" that allows the missing page to be created (if the user has backend privileges). Somehow, the missing page link needs to be sent to the "404 page not found" for a button to be created. Thanks ahead of time, if you try to solve this RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-18 (2016-01-18, 15:51:17)jwzumwalt Wrote:(2016-01-18, 07:04:36)DimaYakovlev Wrote: get_navigation_customget_navigation Well... This is quick and dirty solution for your need. PHP Code: <?php 1. Create plugin with this code and activate it. 2. Create 404 page and template for it. 3. Place in 404 page template this code (in place where you want to get the link to new page creation page): PHP Code: <?php if (function_exists('get_new_page_from_404_link')) get_new_page_from_404_link('Create a new page'); ?> RE: [SOLVED] - Only show page on menu if logged in - jwzumwalt - 2016-01-19 Ok, so I tried this and it locks up my computer. I am sure I am not doing something right. 1) I copied the program and put it in the plugin root directory in a file called "newpagefrom404.php" . 2) I created a blank page in my theme root directory called "newpagefrom404.php" and placed the line <?php if (function_exists('get_new_page_from_404_link')) get_new_page_from_404_link('Create a new page'); ?> in it. When I activate the plugin, it locks up. RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-19 (2016-01-19, 07:46:51)jwzumwalt Wrote: Ok, so I tried this and it locks up my computer. You can send me zip of your site and I will help you to configure it properly. RE: [SOLVED] - Only show page on menu if logged in - jwzumwalt - 2016-01-19 (2016-01-19, 16:55:36)DimaYakovlev Wrote: You can send me zip of your site and I will help you to configure it properly. If you are familiar with ftp, I can create a ftp user account for you. Will that be ok with you? RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-19 (2016-01-19, 17:32:20)jwzumwalt Wrote:(2016-01-19, 16:55:36)DimaYakovlev Wrote: You can send me zip of your site and I will help you to configure it properly. Ok! But also I need access to admin area. RE: [SOLVED] - Only show page on menu if logged in - shawn_a - 2016-01-19 I would just use my component hook plugin and a small component. less complicarted RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-19 (2016-01-19, 22:27:38)shawn_a Wrote: I would just use my component hook plugin and a small component. less complicarted Hey, Shawn, I don't now about your plugin before. A lot of things can be done with it without developing standalone small plugins. RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-19 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 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'); ?> RE: [SOLVED] - Only show page on menu if logged in - shawn_a - 2016-01-20 You can probably just stick a link on the page if logged in and 404. It can literally be one line of code. if(blargh) echo get_site_url(false) . $GSADMIN . '/edit.php?title=' . _id($id); But does $id work since we redirect to 404 ? Also you don't call get_component with my plugin.... RE: [SOLVED] - Only show page on menu if logged in - shawn_a - 2016-01-20 Install my component hook plugin create component called hook_content-bottom add this to it PHP Code: <?php Done RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-20 (2016-01-20, 00:43:46)shawn_a Wrote: You can probably just stick a link on the page if logged in and 404. There is no redirect if default or user 404 page existed. So $id is setted from $_GET array and $url is setted from $data_index object. In my code I want to set value for page slug not for title, because page was requested by slug. For this I need to call hook in admin header. RE: [SOLVED] - Only show page on menu if logged in - shawn_a - 2016-01-20 The slug will automatically be set from the title, so it makes no difference, and makes the code simpler, since you cannot preset slug through querysting hmm, I see the problem now, it still doesn't populate, so you can change the title. hmm I wonder if there is another way around that, definitely something i want to fix in the future. I guess set $url global via another hook... It looks like we removed this functionality at some point as there is a $uri querystring param that is not used. RE: [SOLVED] - Only show page on menu if logged in - DimaYakovlev - 2016-01-20 (2016-01-20, 01:20:19)shawn_a Wrote: The slug will automatically be set from the title, so it makes no difference, and makes the code simpler, since you cannot preset slug through querysting Yes, slug will be automatically setted from title on page save. But in this situation slug must be setted firstly and it not depend from title. Just because we need create page with slug what have been requested. |