MyBB Community Forums

Full Version: change the redirect address after login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

How can I change the redirect address after login ?


For Example, you see this topic as a guest:

http://www.irangeotechnic.com/forums/sho...ge=english

The notification say:

You are not allowed to view links. Register or Login to view.

when I login , I go directly to the :

http://www.irangeotechnic.com/forums/usercp.php

but I want to go to above topic after loging.
1. Open the member.php file in a text editor.

2. Find:

redirect("index.php", $lang->redirect_loggedout);

3. Replace with:

redirect($_SERVER["HTTP_REFERER"], $lang->redirect_loggedout);

4. Find:

redirect("index.php", $lang->redirect_alreadyloggedout);

5. Replace with:

redirect($_SERVER["HTTP_REFERER"], $lang->redirect_alreadyloggedout);

6. Save the member.php file and re-upload it.
Dear Fábio Maia My problem due to loggedin, Do you think I should change these codes?

I look at the member.php file and find the redirect address like this:

// Redirect to the URL if it is not member.php
redirect("http://www.irangeotechnic.com/forums/usercp.php"); 

}
		else
		{
			redirect("index.php", $lang->redirect_loggedin);
		}


someone tell me to chage it to this :



// Redirect to the URL if it is not member.php
			redirect(htmlentities($_SERVER["HTTP_REFERER"]), $lang->redirect_loggedin);
			//die("Dr.Feri this is the redirection to pre page :"$mybb->input['url']."<br>".$_SERVER["HTTP_REFERER"]);

		}
		else
		{
			//die($mybb->input['url']."<br>".$_SERVER["HTTP_REFERER"]);
			redirect("index.php", $lang->redirect_loggedin);
		}


I do that but, I still have a problem.

in this case,when I login, The Notice appears:

Notice: You are already currently logged in as test1.

and it can not automatically came back in to the post, where I log from there.

whats your opinion about my code?

Heart