Login Redirect

Guides & Snippets for phpBB3. Try the Snippets here and share Your own Snippets
There is no support here! Only Read Access!
Locked
User avatar
Post Bot
BBCoder II
BBCoder II
Posts: 44
Joined: 04 Mar 2010, 20:53

Login Redirect

Post by Post Bot »

Login Redirect
Written by primehalo

Returns a user to the page they were at prior to logging in.

Open: includes/functions.php
Find:

Code: Select all

$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login');
Add after:

Code: Select all

//-- mod: Prime Login Return ------------------------------------------------//
		$redirect = ($user->page['page_dir'] || $user->page['page_name'] == "ucp.$phpEx") ? '' : '&redirect=' . urlencode(str_replace('&', '&', build_url(array('_f_'))));
		$u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login' . $redirect);
//-- end: Prime Login Return ------------------------------------------------//
Find:

Code: Select all

// application/xhtml+xml not used because of IE
	header('Content-type: text/html; charset=UTF-8');
Add before:

Code: Select all

//-- mod: Prime Login Return ------------------------------------------------//
	if (($redirect = request_var('redirect', '')) != '')
	{
		$template->assign_var('S_LOGIN_REDIRECT', build_hidden_fields(array('redirect' => $redirect)));
	}
//-- end: Prime Login Return ------------------------------------------------//
cisco007
BBCoder VI
BBCoder VI
Posts: 1015
Joined: 16 Mar 2010, 18:14
Location: Don't really know!

Re: Login Redirect

Post by cisco007 »

once again you are making Oliver very happy!
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Login Redirect

Post by Oliver »

Very Good. Thanks. These are very hard to find.
cisco007
BBCoder VI
BBCoder VI
Posts: 1015
Joined: 16 Mar 2010, 18:14
Location: Don't really know!

Re: Login Redirect

Post by cisco007 »

they are not hard to find, you just have to know how to look!
Locked