Login/Registration Page Redirect

Discussion forum for MOD Writers regarding MOD Development.
sleaver
Registered User
Posts: 24
Joined: Tue Jul 28, 2009 11:11 am

Login/Registration Page Redirect

Post by sleaver »

I'm developing (on and off) a site that is going to use custom pages quite heavily to keep the same style outside of the forums.

What I would like to do is when people log in or register from one of the main site pages they are redirected to a profile page on the main site, but when they log in or register from a forum page they are redirected as per the forum normally would.

Is this possible?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

You can put the destination page in a "redirect=" parameter, either in a hidden form field or in the action URL for your login form.
sleaver
Registered User
Posts: 24
Joined: Tue Jul 28, 2009 11:11 am

Re: Login/Registration Page Redirect

Post by sleaver »

Brf wrote:You can put the destination page in a "redirect=" parameter, either in a hidden form field or in the action URL for your login form.
Can I do that even if I'm using the forum login page? Or only if I create my own login page outside of the forum?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

You can redirect from any login page, but you said you wanted the forum login page to redirect normally.
sleaver
Registered User
Posts: 24
Joined: Tue Jul 28, 2009 11:11 am

Re: Login/Registration Page Redirect

Post by sleaver »

The main site will redirect to the forum login page if a page requires a user to be logged in. In this case I would like the user redirected to a certain page.

If the user is redirected to the login page via somewhere in the forum I would like the redirection after that to act as normal.

Can I pass the login page a variable and then do an if statement on wheather or not the redirect parameter is included in the HTML?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

sleaver wrote: Can I pass the login page a variable and then do an if statement on wheather or not the redirect parameter is included in the HTML?
There is no need for an IF. If you include the "redirect=" parameter in either the form, or the action URL, then it redirects to that URL, as I already explained.
comkidwizzer3
Registered User
Posts: 375
Joined: Fri Jul 13, 2007 8:24 am
Location: $user->data['user_location'];
Contact:

Re: Login/Registration Page Redirect

Post by comkidwizzer3 »

Example URL ;)

Code: Select all

http://localhost/ucp.php?mode=login&redirect=index.php
~My MODs~
Login After Register - v1.0.0 | Custom Ranks MOD - RC

~!Hasher!~
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

No.

Code: Select all

ucp.php?mode=login&redirect=whatever
comkidwizzer3
Registered User
Posts: 375
Joined: Fri Jul 13, 2007 8:24 am
Location: $user->data['user_location'];
Contact:

Re: Login/Registration Page Redirect

Post by comkidwizzer3 »

Isn't that what I wrote?
~My MODs~
Login After Register - v1.0.0 | Custom Ranks MOD - RC

~!Hasher!~
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

No.
You had login.php
comkidwizzer3
Registered User
Posts: 375
Joined: Fri Jul 13, 2007 8:24 am
Location: $user->data['user_location'];
Contact:

Re: Login/Registration Page Redirect

Post by comkidwizzer3 »

I edited it before you posted ;)

And I do loads of typos, I re-read after I submitted the post so I normally edit asap
~My MODs~
Login After Register - v1.0.0 | Custom Ranks MOD - RC

~!Hasher!~
sleaver
Registered User
Posts: 24
Joined: Tue Jul 28, 2009 11:11 am

Re: Login/Registration Page Redirect

Post by sleaver »

Sorry but I'm getting confused now.

As an example, say pages A, B and C all require you to be logged in, can the redirect do the following?

A redirects to LOGIN which redirects to Z
B redirects to LOGIN which redirects to D
C redirects to LOGIN which redirects to D

Where A, B and C all use the forum login page.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

What do you mean by "forum login page"?
Each page can have its own login form, with its own parameters.
sleaver
Registered User
Posts: 24
Joined: Tue Jul 28, 2009 11:11 am

Re: Login/Registration Page Redirect

Post by sleaver »

The login page supplied in the download for phpBB, called login.php I think. Or the ucp.php that displays the login page.

I don't really want to create different login pages so I want to soley use the one provided by phpBB but if a custom page calls it the user gets redirect a different way as to if they were requested to login from a page within the forum.

root\index.php -> login -> root\profile.php
root\forum\index.php -> login -> root\forum\showthread.php?......

Where login is exactly the same page in both examples.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52126
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Login/Registration Page Redirect

Post by Brf »

There is no "file which displays the login".
For pages, such as the index, the login is built into the template, which would have the redirect as a hidden input.
For other pages, it is brought up by using login_box() which has the redirect as its first parameter.
Locked

Return to “[3.0.x] MOD Writers Discussion”