Camen Design Forum

How to display more menu for logged in user?

Martijn

NoNonsense Forum does not really have logged in users. This might make adding additional functionality hard. Note however that this is a conscious decision. When NNF launched [1] this was mentioned:

I don’t want to go through registration and _[…]_ logging in each time.

In fact, this was already an explicitly stated goal of a forum 2 years for the NNF blog post was published on Kroc’s site. Under a section No session, no login, no registration, he writes:

You never have to log in through a dedicated login page beforehand every time, and there’s no session and no cookies so the forum never has to bother you about logging in to post.

So when logged in users are not a thing in the software, that would have to be where you start: build a system for letting users log in. Though if some sort of members-only section is a need for your project, your project might just be too big for NoNonsense Forum to be an effective solution.

All that said, there is a place where NoNonsense Forum sort of simulates the existence of logged in users. The little sign in link in the footer of this very page. When you click it, your web browser will ask you for your username and password. (Important: your browser asks you, not the website!) When you enter your login there, your browser will send it to every page every time.

This is as if you are logging in over and over again, and is how the forum can offer a sign in link without doing any cookies or session handling itself.

You *might* be able to use this logic to show different content to people logged in with this link than to others. Currently the forum is already doing that, see for example lines 278 through 282 of index.php: https://github.com/Kroc/NoNonsenseForum/blob/e8a996c6cd3eb97c9de8762e3aa31b3b29508f93/index.php#L277-L282

Using the theming system, you should be able to add an extra menu to the forum and then add a little bit of DOM templating [3] to your theme’s theme.php file where you use the `AUTH_HTTP` constant in the same way as the forum is doing in index.php.

That should work. Not sure if it will be super clear for your users though, and it is taking a step away from the goals of the forum.

---

[1]: NoNonsense Forum, 1. Features: https://camendesign.com/nononsense_forum#features
[2]: Camen Design: Now With Added Forums, 2. Goals: https://camendesign.com/forums#goals
[3]: Making the Ugly Elegant: Templating With DOM: https://camendesign.com/dom_templating

Append

(Leave this as-is, it’s a trap!)

Only the original author or a moderator can append to this post.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn