[FAQ] How to make your forum private
-
This should probably go into the documentation at some point but I thought I'd post this on the forum for now.
Hiding /users route from public
In the Settings ACP, select "Make user info private"
Hiding categories from non-registered users
In the Categories ACP, for each category click on "Options" and then "Access Control". For registered-users and administrators, select all boxes like so:
Leave these four options blank for guests.Redirecting guests to the login page
In the Themes ACP, click on "Widgets" and drag an HTML widget onto the Global Header widget area. In the HTML field, copy and paste the following code and then hit save.
<script> if (!app.uid && ajaxify.currentPage !== 'login' && ajaxify.currentPage !== 'register') { ajaxify.go('login'); } </script>
-
Funny enough he asked that same question a little while ago, let me search for it
-
-
@psychobunny said:
Close enough. I'm going to add a full splash screen which covers the homepage, then either logging in or clicking Continue As Guest will show the homepage.
-
Same here. When I get the free time I want to add a splash page for this forum that lists the latest blog entries, active threads from today, and some better messaging about our premium hosting etc
-
@psychobunny said:
Same here. When I get the free time I want to add a splash page for this forum that lists the latest blog entries, active threads from today, and some better messaging about our premium hosting etc
Good stuff, if I make any progress on this, I'll post the code up. Shouldn't be too difficult.
-
Thanks for the guide, really appreciate the effort to include those of us who need private forums as well.
Now, if only we had a single button or checkmark option to do all these steps in one go...
-
A little necromancy update for the above JS for 2016 and nodebb 1.2.1:
<script> $(window).on('action:ajaxify.end', function(event, data) { if (!app.user.uid && ajaxify.currentPage !== 'login' && ajaxify.currentPage !== 'register') { ajaxify.go('login'); } }); </script>
-
More necromancy. This probably isn't the most elegant way to do this, but it seems to work, and the other two posted above no longer do.
<script> try { if (!app.user.uid && window.location.pathname !== '/login' && window.location.pathname !== '/register' && !window.location.pathname.startsWith('/reset')) { document.location.replace('/login'); } } catch (error) { // the page hasn't yet loaded } window.onload = function () { if (!app.user.uid && window.location.pathname !== '/login' && window.location.pathname !== '/register' && !window.location.pathname.startsWith('/reset')) { document.location.replace('/login'); } }; </script>