How to display selected menu items to logged-in users only? #889
-
I'd like to create my ToDo list as a menu item. But in such a way that it only appears when I am logged in. Is that possible and if so, how? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 <?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 echo $todo->getLocation(true) ?>"><?php echo $todo->getHtml("titleNavigation") ?></a></li>
<?php endforeach ?>
<?php } ?> Now I have a "ToDo" menu item every time I call |
Beta Was this translation helpful? Give feedback.
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 mylayout-navigation.php
: