Forums / Setup & design / [Resolved] Redirect after login problem

[Resolved] Redirect after login problem

Author Message

David Cuel-Oller

Thursday 28 August 2008 5:32:20 am

Hi there,

I'm trying to redirect users after login, (following a post read somewhere around here)
I added a redirect field to the user class and modified accordingly ini files.

When I try to log from the frontpage, clicking on the log link, it works.
But when triying the same action from another page it redirects me to that page and noàt to the redirect link written in the users params.

Any ideas (am I clear ?)

Thank you in advance

David

David Cuel-Oller

Thursday 28 August 2008 6:02:32 am

A reply to myself !

I hacked into the /kernel/user/login.php and around line 197 :
if ( is_object( $user ) && !$haveRedirectionURI )

Modifiied for :
if ( is_object( $user ) )

I think it force redirectURL to be the user's one (if any) !

Works just fine ! Now user is ever redirected to its own page.

Any comments ?

Regards,

David

Maxime Thomas

Tuesday 02 December 2008 10:57:06 pm

Hi,

I understand that you are proud to have found a solution to your issue but hack the kernel is a very very very very bad habit ! The main reason is that the day you will update your ez instance, you will have to hack again the kernel...

As far as I remember, in the login.tpl file you can put an hidden input called RedirectAfterLogin and its value is the correct URL where you want your user to go. As it's in the template you can generate it...

Max

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas