eZ Community » Forums » Setup & design » [Resolved] Redirect after login problem
expandshrink

[Resolved] Redirect after login problem

[Resolved] Redirect after login problem

Thursday 28 August 2008 2:32:20 pm - 2 replies

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

Modified on Thursday 28 August 2008 11:16:11 pm by David Cuel-Oller

Thursday 28 August 2008 3:02:32 pm

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

Wednesday 03 December 2008 7:57:06 am

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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu