MyBB Community Forums

Full Version: Force login on board index only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to force login on my board index only while every other page can be accessible without login. Please can someone help me with these?
You mean this /member.php?action=login if so in the header_welcomeblock_guest template find:

<span id="quick_login">{$lang->welcome_guest} (<a href="{$mybb->settings['bburl']}/member.php?action=login" onclick="MyBB.quickLogin(); return false;">{$lang->welcome_login}</a> &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>)</span>

Replace with:

<span id="quick_login">{$lang->welcome_guest} (<a href="{$mybb->settings['bburl']}/member.php?action=login">{$lang->welcome_login}</a> &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>)</span>
You don't understand. I want to force login on the board index (index.php) only so that it will require guests to login before viewing. Maybe redirecting guest to the login page will do but I need it only on the board index. Thanks.

(2013-12-22, 05:44 AM)inyavic1 Wrote: [ -> ]You don't understand. I want to force login on the board index (index.php) only so that it will require guests to login before viewing. Maybe redirecting guest to the login page will do but I need it only on the board index. Thanks.

Please @ all, I'm still waiting for your reply
Please forgive me if I am wrong AGAIN, you want to make your forum viewable by logged in users only, I mean that to view your forum guests need to login?

If so go to your ACP>>Users & Groups>>Groups>>Guests>>Forums and Post under Viewing Options you will find you answer!
(2013-12-22, 05:41 PM)marcus123 Wrote: [ -> ]Please forgive me if I am wrong AGAIN, you want to make your forum viewable by logged in users only, I mean that to view your forum guests need to login?

If so go to your ACP>>Users & Groups>>Groups>>Guests>>Forums and Post under Viewing Options you will find you answer!

I didn't say forum, I said board index that is my homepage only. I don't want to restrict guest from viewing my forum. I only want to restrict them from the viewing the board index, instead they will be taken to the login page. I know this can be done in the index template but I'm not a coder so I don't know how to go about it.
If you uncheck Can view board? option in ACP then they will not be able to see index whey'll get the login form
(2013-12-23, 02:31 PM)marcus123 Wrote: [ -> ]If you uncheck Can view board? option in ACP then they will not be able to see index whey'll get the login form

That's the problem. If I uncheck "Can view board", guest won't be able to view threads but I want them to be able to view threads. You get me?

I only want to restrict guest access on index page.
I'm so happy I've done it at last.

Here's the code

<?php
if(!$mybb->user['uid'])
{
error_no_permission();
}
?>

I inserted it in my index template and it worked although I use a pluginto enable php code in templates.

Thanks for your time anyway. Just that you didn't understand me.
Do you realize that this will also restrict access to Google and others ain't good for SEO baby!!
That's the reason I want to do it in my index only. So that guest and bots can be able to access other pages.