Camen Design Forum

Forum as part of Intranet where user already logged-in

append delete Frank

I want to add the forum to an intranet, where the user will have already successfully logged-in with their username and password.
Is there an easy way to disable the prompt for "Your name" and the prompt (and requirement) for "Password", whilst allocating the established session username to "Your name" ?

Reply RSS

Replies

append delete #1. Martijn

I haven’t given this much thought, but the answer is yes. You will have to get into some of the code though.

All the logged in state is checked and set on lines 165–215 of start.php: https://github.com/Kroc/NoNonsenseForum/blob/e8a996c6cd3eb97c9de8762e3aa31b3b29508f93/start.php#L165-L215

You’d probably come a long way by defining the `AUTH` (and maybe `AUTH_HTTP` too) depending on login state in your session. Then define `NAME` as the name from your session.

If you have set `AUTH_HTTP` to true, the theme will by default remove the entire login form and display the user’s name prefilled. So the whole “allocating” is then automatically taken care of (see https://github.com/Kroc/NoNonsenseForum/blob/e8a996c6cd3eb97c9de8762e3aa31b3b29508f93/thread.php#L202-L207).

If you are hacking on the code and would like to brainstorm some ideas, you’re welcome to see if either @Kroc or I are available on the Discord! http://forum.camendesign.com/camen-design-discord-server

append delete #2. Frankagain

Thanks Martijn.

AUTH_HTTP is set to true, and I got around it simply by setting the following in config.php :

session_start();
if(isset($_SESSION["username"])){
@define ('NAME', $_SESSION["username"]);
}

Works a treat. A great simple-to-use board !

append delete #3. Kroc

Great, glad that worked. Once `AUTH` & `AUTH_HTTP` are set to true, NNF just assumes you're logged in.

Massive thanks to @Martijn for stepping in and providing a quick answer.

Reply

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

There is no need to “register”, just enter the same name + password of your choice every time.

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

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn