Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect guest to login page instead of homepage phpbb3

Tags:

phpbb

phpbb3

I would like to keep the entire forum private. Hence I removed the permissions of guest to the forums and all other features as suggested by other people. However when the user visits the forums, he is shown the home page but not the login page.

Can anyone suggest me the right way to do this without hacking the index.php or other core elements of phpbb3?

like image 338
char_x0r Avatar asked Nov 20 '25 22:11

char_x0r


1 Answers

Know I'm coming in late but I hard-coded a redirect:

if ($user->data['user_id'] == ANONYMOUS)
{
    header('Location: [your phpbb location]/ucp.php?mode=login');
    exit;
}

right after these lines

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

in the index.php file found in the root of your phpbb project.

This will redirect unauthorized users directly to the login page as soon as they hit the index.php page.

NOTE: Anytime an unauthorized user hits the index file they will be redirected to the login page (e.g. after logging out)

like image 121
Greg Venech Avatar answered Nov 24 '25 22:11

Greg Venech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!