Pre filled user register / Login handler redirection

Author Message

Maxime Thomas

Monday 25 August 2008 3:05:28 am

Hi,

I have to implement the following feature : we are migrating a website based on SQLServer and we would like not to import all the users in the database for performances reasons.
So, we decided to check if the user exists in a list of former users and then to show the user register form pre filled by the former information.
I currently created a specific Login Handler and I find the former user in the list. I also set the variable as a session variable to mak it available in the user register form. The only problem is that if the user is not authentified, he is redirected to the user login form. So, as our former user doesn't exist, he will always be redirected to the login page.
My idea was to redirect him directly at the end of the login handler but I cannot figure out how to access the $Module value...

If someone knows how...

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

Maxime Thomas

Monday 25 August 2008 3:21:18 am

I tried with the $http->redirect function so I can redirect my user to the user register form and pre filled the form with the values stored in the session. But when I try with another former user, I still get the data of the former user... Though, I have cleaned the session variable. Very strange.

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

Maxime Thomas

Monday 25 August 2008 3:43:42 am

Apparently, when you change the header you lose the changes of the PHP session. Too bad. Does someone know how to avoid that beahvior ?

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

Maxime Thomas

Monday 25 August 2008 4:42:13 am

So, it seems to be a common solution, just close the session handler before redirect by :

session_write_close();

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

Victor Dujardin

Thursday 12 March 2009 9:16:12 am

Hi Maxime,

Like you did, I'm interested in checking a user existence in a (not eZ) database before registering.
Could you help me and give some tips to manage that, e.g. files to modify or even code if you don't bother. This would be really helpful.

Thanks.

Jean-Yves Zinsou

Friday 13 March 2009 3:33:17 am

Hi Maxime, thanx for sharing ... Can be very usefull!

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:16:12
Script start
Timing: Jan 18 2025 19:16:12
Module start 'layout'
Timing: Jan 18 2025 19:16:12
Module start 'content'
Timing: Jan 18 2025 19:16:12
Module end 'content'
Timing: Jan 18 2025 19:16:12
Script end

Main resources:

Total runtime0.0165 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0469152.6406
Module start 'layout' 0.00570.0029 740.687539.4922
Module start 'content' 0.00860.0059 780.179797.4922
Module end 'content' 0.01450.0019 877.671938.3047
Script end 0.0165  915.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002615.6291140.0002
Check MTime0.00127.1722140.0001
Mysql Total
Database connection0.00127.279110.0012
Mysqli_queries0.002213.338530.0007
Looping result0.00000.133010.0000
Template Total0.00159.210.0015
Template load0.00084.751610.0008
Template processing0.00074.449610.0007
Override
Cache load0.00053.316610.0005
General
dbfile0.00031.550680.0000
String conversion0.00000.054940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs