Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Mod Name / Version: Login Redirection

Description: After the user has logged in they will be redirected to the page they were on when they clicked the login link.

Working Under: UBB.Threads 6.4-6.5

Mod Status: Beta

Any pre-requisites:

Author(s): Gardener

Date: 07/20/04

Credits:

Files Altered: templates/default/ubbt_unregisterednav.tmpl templates/default/login.tmpl ubbt.inc.php

New Files:

Database Altered: None

Info/Instructions:

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Attachments
117006-ubbt_login_redirection-1_0.txt (0 Bytes, 128 downloads)

Last edited by Gardener; 07/21/2004 5:03 AM.
Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
Thanx Gard

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
No problem. I'm so used to this now from Mambo that I get very annoyed on sites where it doesn't work so I thought I might as well create a mod for it.

I was thinking of having the login page getting the referer so that it would work regardless of how you got to the login page, but since some Personal Firewalls strip this I thought it was better to just use the login link in the navigation bar instead. If you have login links in other places you could add the same thing as in the ubbt_unregisterednav.tmpl file to make it work there as well.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Cool, that one was on my list for a long time.
Just as a note. REQUEST_URI doesn't work on all php configurations. It shouldn't work if you use FASTCGI for example.
But you can use something similar, for example:
$return = "http://" .$_ENV['SERVER_NAME'] . $_ENV['PATH_INFO'];

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Thanks for the heads up! I'll leave it as an exercise to whoever needs it how to change this in the mod though. =]

Sponsored Links
Joined: Jun 2003
Posts: 131
Journeyman
Journeyman
Offline
Joined: Jun 2003
Posts: 131
I'm sure someone has asked this somewhere already, but why isn't this available in the standard threads, at least as an administrative option? and maybe as something a user can set back to the present state of affairs if desired! Tony

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
Joined: Apr 2002
Posts: 474
This is Awesome... It works for 6.5

But how do I get it to work when I have IIP and Sidebar with the loginpal?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Thanks, I'll add that to the list of versions it works for.

You can add the following to the login form in the loginpal:

Code
<br />$return = urlencode( find_environmental( "REQUEST_URI" ) );<br />print "<input type='hidden' name='return' value='$return' />";<br />

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
Joined: Apr 2002
Posts: 474
Thanks' G

Joined: Feb 2004
Posts: 13
Newbie
Newbie
Offline
Joined: Feb 2004
Posts: 13
Where exactly in the loginpal do you place this?

Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
It depends on which version of IIP you are running... But it's where the rest of the form is printed... In my (old) version there's a line that looks like this:

echo "<tr><td class="lighttable"><input type="submit" name="submit" value="{$pal_LoginStatus[5]}" class="buttons" onclick="return checkLogin()" /><input type="hidden" name="firstlogin" value="1" /><input type="hidden" name="Cat" value="$Cat" /><input type="hidden" name="buttlogin" value="$ubbt_lang[BUTT_LOGIN]" /><br /><input type="checkbox" name="buttforgot" value="{$pal_LoginStatus[11]}" /> {$pal_LoginStatus[11]}$palRemember</td></tr></table></form>{$wrapper[$wrapnum]['table_footer']}";


It should look like this:
$returnpage = urlencode( find_environmental( "REQUEST_URI" ) );
echo "<tr><td class="lighttable"><input type="submit" name="submit" value="{$pal_LoginStatus[5]}" class="buttons" onclick="return checkLogin()" /><input type="hidden" name="firstlogin" value="1" /><input type="hidden" name="Cat" value="$Cat" /><input type="hidden" name="buttlogin" value="$ubbt_lang[BUTT_LOGIN]" /><br /><input type="checkbox" name="buttforgot" value="{$pal_LoginStatus[11]}" /><input type="hidden" name="returnpage" value="$returnpage" /> {$pal_LoginStatus[11]}$palRemember</td></tr></table></form>{$wrapper[$wrapnum]['table_footer']}";


Notice the extra line above as well.

Joined: Mar 2003
Posts: 2
Lurker
Lurker
Offline
Joined: Mar 2003
Posts: 2
Is it possible to have a autlogin, users that are subscribed, in the subscriptions mail that would take you to the actual post. I have a lot of users that have bad password memories, autologin from the board is no good as they move around on different PC's. Big Thanks

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Shouldn't be too hard to change the link in the email to go to the login page instead with the real link as the return page. But that would make the link in the mail very long. Maybe it would be better to just have some indication that the user should be returned to a specified post instead. That shouldn't be very hard either, but would require some extra coding in the login page as well.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)