MyBB Community Forums

Full Version: Private MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I want to have a private mybb, that requires a login on all except 2 pages. (Both URL's I want guest access end in .php, incase it matters)

I have this:
Right, this seems to do the trick. Open up global.php and find the line:

PHP Code:
$plugins->run_hooks("global_end");

After the above line, add this:

PHP Code:
if ($mybb->user['uid'] == 0 AND $current_page != 'member.php' AND ($mybb->input['action'] != 'login' OR $mybb->input['action'] != 'do_login')) {
redirect('member.php?action=login', "Please login to access this site.", "Please Login");
}

Now if the user is not logged in and goes to any pages except the login pages, they will be redirected to login.



What do I need to edit to allow the index.php, and media.php to be accessible to guests?

Thanks!
Anyone out there have any ideas?
Maybe specify that index.php at the same time as member.php?
Like adding multiple pages to the member.php you mean?
I'm confused, basically you want guests to be able to view all of your forum except threads?
pseudocode:


if ($mybb->user['uid'] == 0 AND $current_page == 'index.php')
return;
elseif ($mybb->user['uid'] == 0 AND $current_page != 'member.php' AND ($mybb->input['action'] != 'login' OR $mybb->input['action'] != 'do_login')) {
redirect('member.php?action=login', "Please login to access this site.", "Please Login");
}
(2012-12-29, 02:49 AM)pandaa Wrote: [ -> ]I'm confused, basically you want guests to be able to view all of your forum except threads?

Simply the index page. As in, they can see the latest post in a thread, just like the index here (mybb), except they can't see anything else.
As if you were to click on something, you need to login.

Thank you lee, I'll be sure to see if it works as planned Smile
Hmm.. it doesn't exclude any pages :/
I kinda need the contact page, and the media page to be guest accessible.