SimplePortal

Support => English Support => Topic started by: ROZA on October 26, 2015, 12:43:45 PM

Title: Redirecting user to the previous/last visited page url after login
Post by: ROZA on October 26, 2015, 12:43:45 PM
I asked this on smf community but they told me should ask it here!
 After users login to my site successfully(whatever way they choose/forced to login, including using original Login form from menu or filling the quick Login box on top of every pages etc) , I want to redirect them to their previous viewed page where they logged in from instead of homepage or board index.In this case the simple machines site itself has this feature I'm looking for. I use smf 2.0.11 and simple portal 2.3.6 and several other mods.
Thanks in advance for your comments and sorry for my poor English!
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 26, 2015, 05:34:26 PM
ROZA,

Please check "Administration Center" - "SimplePortal" - "Configuration" - "General Settings" - "Disable Portal Redirection"

Regards
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ROZA on October 27, 2015, 01:38:02 PM
Dear Ninja, That setting just determines which one of these two pages(portal homepage or forum index)will be shown to users after they login not the page they visited before login.
Quote
Consider a situation where user access a specific page which requires login to proceed. If the user is currently not logged in he will be redirected to the login page. Once user logs in successfully with valid credentials, web site redirects a user to one of those mentioned pages. User has to go through a menu or search in order to go to the page where he was trying to access before login. This is not user friendly since user wants to automatically redirect to the page he was trying to access before login.
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 27, 2015, 06:07:35 PM
Well, automatic redirect to the last seen page is a standard SMF feature and the only way SimplePortal can alter it is the one I mentioned. I just tried what you quoted and works perfectly fine on my forum, it redirects to the previously visited page (my case, an hidden section), not on Board Index.

So to summarize:
1) This is actually a typo within the Help text of that checkbox, because it switches between redirecting on portal and no redirect, which is totally different from what it claims to be doing.
2) Your issue is not within SimplePortal if that box is already checked, if it isn't... Check it.

I am currently investigating further about that checkbox. Thanks for your report and sorry for the inconvenience.
EDIT: My thesis is that I when you go to the Login area then it goes to BoardIndex or Portal, and always on Portal if it's unchecked. However, the description is still wrong and needs to be fixed.

Best regards
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ccbtimewiz on October 27, 2015, 06:28:39 PM
Hello,

The reason for this behavior is because custom pages do not have login_url set.

You can do change this behavior by opening /Sources/PortalPages.php

Find:
Code: [Select]
$page_id = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;
Replace with:
Code: [Select]
$page_id = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;

$_SESSION['login_url'] = $scripturl . '?page=' . $page_id;
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 27, 2015, 06:31:20 PM
Further investigation (with Sayaka) showed that it's actually a little bug with pages, and only happens with ***SimplePortal custom pages*** (to make it clear). If you login from any custom page it will always redirect to BoardIndex or Portal no matter what you do, I will add this to the bug tracker for the following version.
EDIT: added to the bug tracker.

And thanks Sayaka for the fix ;)
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ROZA on October 28, 2015, 03:35:53 AM
Thank you very much for your replays Ninja and Sayaka,
 I did check the disable redirect setting and also I changed the code you mentioned in PortalPages.php but still the problem persists. For me It does not happen only with  SimplePortal custom pages But for all pages/posts/topics. actually I do not have any custom page yet. I tried different ways to log in, but always be referred to the forum index. When you Ninja are saying:
Quote
I just tried what you quoted and works perfectly fine on my forum, it redirects to the previously visited page (my case, an hidden section), not on Board Index.
So IMO It means that maybe this issue just exists on my forum.But why? How do I figure out where the problem has arisen? Please if you know something about it, do not hesitate to tell. I would be grateful.
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 28, 2015, 12:12:06 PM
Hmm, please provide your mod list, I have around 140 of them and it's not happening, so I should be able to give you some hints about it.

Regards
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ROZA on October 29, 2015, 03:44:21 AM
Thanks for your support. The list of my installed mods:

1.   Similar Topics   0.6   
2.   Custom Action Mod   3.2   
3.   Custom Copyright   1.0.4   
4.   SMF 2.0.11 Update   1.0   
5.   MDLT: Manage Default Linktree   1.2   
6.   Pretty URLs   1.1.2   
7.   SA Chat   1.0a Rev120   
8.   Default Avatar   2.3   
9.   Like Posts   2.0.5   
10.   Board Icons   1.0   
11.   Responsive Curve   1.0 Beta 5   
12.   httpBL   2.5.1   
13.   SimplePortal   2.3.6


And also I have these mods uploaded:

1.   Site Integration Mod   1.41   
2.   Menu Editor Lite   1.0.5   
3.   SMF Articles   3.0.2   
4.   SA KB   1.2   
5.   Stop Spammer   2.3.9   
6.   Simple ImgBR Upload Image in CSS - upload by URL   1.0   
7.   SMF Links   3.0.5   
8.   Downloads System   2.5   
9.   Breeze   1.0.8   
10.   Forum Firewall   2.0.0   
11.   Bakers Dozen Pages   1.2   


In addition, the language of my website is right to left if that matters.
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 29, 2015, 04:55:15 PM
Oh, PrettyURLs. With all due respect to its developers it's one of the worst mods around, it is known to cause a *lot* of problems (without being useful either - ref: http://www.simplemachines.org/community/index.php?topic=427913.10) and most likely this one as well because I have all of your other mods installed, excluding the linktree (I personally recoded that entirely to make it responsive) and also SAChat which has been banned by my host because a bug in it was causing *major* server overloadings.

Sorry if this was not exactly what you wanted to read, but I'd rather be frank about it than throwing some excuses :/

Disclaimer: in no way I (nor SP team) am attacking Pretty URLs developers, I am just basing myself on facts, sadly.

Regards
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ROZA on October 30, 2015, 05:19:36 AM
Well, actually that was what I wanted to read! I uninstalled PrettyURLs and also SAChat(I don't know why but nobody was using this one on my forum!)   and yes! the problem has been solved and now smf redirect me to the my last visited page after login!
 Thank you Ninja ZX-10RR I really appreciate your help.
Title: Re: Redirecting user to the previous/last visited page url after login
Post by: ♦ Ninja ZX-10RR ♦ on October 30, 2015, 07:45:41 AM
Glad you got it fixed, I am marking the topic as solved seeing your reply, in case you have further problems feel free to mark it as unsolved by clicking the relative button ;)

And... You're welcome. I said that because usually people that have it installed tend to stick a lot to PrettyURLs mod, but apparently you are an exception to that ;D
All in all awesome topic, the problem got fixed and we found something that can be improved as well, very nice.

Best regards
SimplePortal 2.3.8 © 2008-2024, SimplePortal