Skip to content

How to display selected menu items to logged-in users only? #889

Answered by pftnhr
pftnhr asked this question in Ask a question
Discussion options

You must be logged in to vote

I was able to help myself, but first I would like to say a few words about my request: I have created a ToDo page in which I display drafts and note down what I still want to implement and set up. This page should appear in the menu when I am logged in.

After a bit of trial and error, I had the right idea: I copied the draft extension, renamed all occurrences of the term "draft" to "todo" and saved the file as todo.php. Then I added the following code to my layout-navigation.php:

<?php if ($this->yellow->user->isUser("name") == "MyFantasticUserName") { ?>
	<?php foreach ($todos as $todo): ?>
		<li><a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pftnhr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant