How can I make a page only show on the menu if the user is logged in?
Thanks,
jwzumwalt
(\__/)
(='.'=)
(")_(")
jwzumwalt
(\__/)
(='.'=)
(")_(")
The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
|
[SOLVED] - Only show page on menu if logged in
|
How can I make a page only show on the menu if the user is logged in?
Thanks,
jwzumwalt (\__/) (='.'=) (")_(")
2016-01-13, 04:40:45
2016-01-13, 04:42:43
Private pages are not filtered automatically in menus, you have to write your own menu functions.
It only controls its visibility /access
2016-01-18, 07:04:36
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 = "") { (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
Thanks,
jwzumwalt (\__/) (='.'=) (")_(")
2016-01-18, 17:54:12
(This post was last modified: 2016-01-19, 17:40:49 by DimaYakovlev.)
(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'); ?>
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.
Thanks,
jwzumwalt (\__/) (='.'=) (")_(")
2016-01-19, 16:55:36
(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.
2016-01-19, 17:40:09
2016-01-19, 22:27:38
I would just use my component hook plugin and a small component. less complicarted
2016-01-19, 23:29:03
2016-01-19, 23:46:52
(This post was last modified: 2016-01-20, 01:44:53 by DimaYakovlev.)
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'); ?>
2016-01-20, 00:43:46
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....
2016-01-20, 01:00:08
Install my component hook plugin
create component called hook_content-bottom add this to it PHP Code: <?php Done
2016-01-20, 01:09:04
(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.
2016-01-20, 01:20:19
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.
2016-01-20, 01:27:41
(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. |
« Next Oldest | Next Newest »
|