Page 1 of 1
Redirect to Portal not Index after Login
Posted: 11. December 2014 22:03
by ohockey
Your Portal Version: 2.1.0-RC1
Your phpBB Type: Standard phpBB3
MODs installed: No
Your knowledge: Beginner
Boardlink: http://hockeytime.cu.cc
What have you done before the problem was there?
Nothing
What have you already tryed to solve the problem?
Tried modifying ucp.php but it did not work
Description and Message
After login I would like users redirected to the portal page not the index page. Ideally, I would like the same after they logout as well.
Re: Redirect to Portal not Index after Login
Posted: 12. December 2014 14:25
by ohockey
I want to have the portal the default after login and logout. I currently use a redirect so users see the portal after going to my website. I tried modifying as suggested, even though my portal.php file is different. I get the error:
No route found for "GET /portal.php"
Can you tell me what is wrong?
Code: Select all
My original file looks like the following:
// Basic "global" modes
switch ($mode)
{
case 'activate':
$module->load('ucp', 'activate');
$module->display($user->lang['UCP_ACTIVATE']);
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
break;
case 'resend_act':
$module->load('ucp', 'resend');
$module->display($user->lang['UCP_RESEND']);
break;
case 'sendpassword':
$module->load('ucp', 'remind');
$module->display($user->lang['UCP_REMIND']);
break;
case 'register':
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
$module->load('ucp', 'register');
$module->display($user->lang['REGISTER']);
break;
case 'confirm':
$module->load('ucp', 'confirm');
break;
case 'login':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
login_box(request_var('redirect', "index.$phpEx"));
break;
case 'login_link':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
$module->load('ucp', 'login_link');
$module->display($user->lang['UCP_LOGIN_LINK']);
break;
case 'logout':
if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
{
$user->session_kill();
}
else if ($user->data['user_id'] != ANONYMOUS)
{
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
$message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
trigger_error($message);
}
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
break;
case 'terms':
case 'privacy':
$message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY';
$title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY';
if (empty($user->lang[$message]))
{
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
login_box();
}
$template->set_filenames(array(
'body' => 'ucp_agreement.html')
);
// Disable online list
page_header($user->lang[$title]);
$template->assign_vars(array(
'S_AGREEMENT' => true,
'AGREEMENT_TITLE' => $user->lang[$title],
'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()),
'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'L_BACK' => $user->lang['BACK_TO_LOGIN'],
));
page_footer();
break;
My changed version is this:
// Basic "global" modes
switch ($mode)
{
case 'activate':
$module->load('ucp', 'activate');
$module->display($user->lang['UCP_ACTIVATE']);
redirect(append_sid("{$phpbb_root_path}portal.$phpEx"));
break;
case 'resend_act':
$module->load('ucp', 'resend');
$module->display($user->lang['UCP_RESEND']);
break;
case 'sendpassword':
$module->load('ucp', 'remind');
$module->display($user->lang['UCP_REMIND']);
break;
case 'register':
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
{
redirect(append_sid("{$phpbb_root_path}portal.$phpEx"));
}
$module->load('ucp', 'register');
$module->display($user->lang['REGISTER']);
break;
case 'confirm':
$module->load('ucp', 'confirm');
break;
case 'login':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}portal.$phpEx"));
}
login_box(request_var('redirect', "portal.$phpEx"));
break;
case 'login_link':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}portal.$phpEx"));
}
$module->load('ucp', 'login_link');
$module->display($user->lang['UCP_LOGIN_LINK']);
break;
case 'logout':
if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
{
$user->session_kill();
}
else if ($user->data['user_id'] != ANONYMOUS)
{
meta_refresh(3, append_sid("{$phpbb_root_path}portal.$phpEx"));
$message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
trigger_error($message);
}
redirect(append_sid("{$phpbb_root_path}portal.$phpEx"));
break;
case 'terms':
case 'privacy':
$message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY';
$title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY';
if (empty($user->lang[$message]))
{
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
login_box();
}
$template->set_filenames(array(
'body' => 'ucp_agreement.html')
);
// Disable online list
page_header($user->lang[$title]);
$template->assign_vars(array(
'S_AGREEMENT' => true,
'AGREEMENT_TITLE' => $user->lang[$title],
'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()),
'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'L_BACK' => $user->lang['BACK_TO_LOGIN'],
));
page_footer();
break;
Re: Redirect to Portal not Index after Login
Posted: 13. December 2014 10:08
by Kirk
Hi
Open:
root/ucp.php
Find:
Code: Select all
case 'login':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
login_box(request_var('redirect', "index.$phpEx"));
break;
Replace with:
Code: Select all
case 'login':
if ($user->data['is_registered'])
{
redirect(append_sid("{$phpbb_root_path}app.$phpEx/portal"));
}
login_box(request_var('redirect', "app.$phpEx/portal"));
break;
Find:
Code: Select all
case 'logout':
if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
{
$user->session_kill();
}
else if ($user->data['user_id'] != ANONYMOUS)
{
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
$message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
trigger_error($message);
}
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
break;
Inline find:
Code: Select all
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
Replace with:
Code: Select all
redirect(append_sid("{$phpbb_root_path}app.$phpEx/portal"));
Re: Redirect to Portal not Index after Login
Posted: 13. December 2014 17:49
by ohockey
Thank you for the quick reply. Before I get started, the 2nd find you listed does not have the equivalent replace statement that I believe should be listed. Could you please provide or explain if I am incorrect.
Re: Redirect to Portal not Index after Login
Posted: 14. December 2014 10:54
by Kirk
Sorry i can not translate this message.
The changes are all in the root/ucp.php.
Re: Redirect to Portal not Index after Login
Posted: 1. January 2015 00:37
by thirdoff
How to redirect to portal all the time, even when not logged in?