My login page

Author Message

Jean-François Sénéchal

Friday 24 November 2006 3:39:29 pm

I write a login page
On this page, I user a digital identity, that send me the informations :
login, name,firstname

I I have succeeds to add a user in ez, but I do not know how to add the user in the good group and with encoder his name and first name

here's my script

include_once( 'lib/ezutils/classes/ezhttptool.php' );
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
include_once( 'kernel/common/template.php' );
include_once( 'lib/ezutils/classes/ezini.php' );
include_once( 'kernel/classes/datatypes/ezuser/ezuserloginhandler.php' );

$login = "jfsenechal";
$name = "nom";
$prenom = "toto";

$ini =& eZINI::instance();
$userClassID = $ini->variable( "UserSettings", "UserClassID" );
$userCreatorID = $ini->variable( "UserSettings", "UserCreatorID" );
$class = eZContentClass::fetch( $userClassID );
$defaultSectionID = 132;
$contentObject = $class->instantiate( $userCreatorID, $defaultSectionID );
$objectID = $contentObject->attribute( 'id' );
$userClassID = $ini->variable( "UserSettings", "UserClassID" );
$class = eZContentClass::fetch( $userClassID );
$objectID = $contentObject->attribute( 'id' );
$userId = $objectID;
$passwordLength = 8;
$user =& eZUser::create( $userId );
$password = $user->createPassword( $passwordLength );
$passwordConfirm = $password;
$user->setInformation( $userId, $login, "jf@marche.be", $password, $passwordConfirm );
$isEnabled = 1;
$userSetting =& eZUserSetting::create( $userId, $isEnabled );
$userSetting->store();
$user->store()

Can You help me ?

Thanks

L'informaticien est comme un petit canard:
il est calme en surface mais en dessous il brasse beaucoup d'eau pour
avancer ...!

Claudia Kosny

Wednesday 29 November 2006 1:09:05 pm

Hi

Why don't you use the existing user/register ? I think this would be easier than writing all the code again, even if you have to set it up for different user classes (which is admittedly quite annoying).

Anyhow, I think you still need to create a node assignment for the user object. For some sample code see eg. the usercreatorwizardfinish.php in Kristof's project http://ez.no/community/contribs/import_export/user_creator

Good luck

Claudia

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 31 2025 03:40:37
Script start
Timing: Jan 31 2025 03:40:37
Module start 'layout'
Timing: Jan 31 2025 03:40:37
Module start 'content'
Timing: Jan 31 2025 03:40:38
Module end 'content'
Timing: Jan 31 2025 03:40:38
Script end

Main resources:

Total runtime1.2233 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.0078151.1953
Module start 'layout' 0.00510.0046 739.2031220.6406
Module start 'content' 0.00971.2112 959.84384,299.7109
Module end 'content' 1.22100.0023 5,259.55477.8906
Script end 1.2233  5,267.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.3349160.0003
Check MTime0.00140.1113160.0001
Mysql Total
Database connection0.00080.068210.0008
Mysqli_queries1.130892.4403540.0209
Looping result0.00070.0613520.0000
Template Total1.165195.220.5825
Template load0.00200.166920.0010
Template processing1.163095.068720.5815
Template load and register function0.00200.167010.0020
states
state_id_array0.00170.135410.0017
state_identifier_array0.00350.283020.0017
Override
Cache load0.00170.1384440.0000
Sytem overhead
Fetch class attribute can translate value0.00250.202720.0012
Fetch class attribute name0.00340.279720.0017
XML
Image XML parsing0.00040.033820.0002
class_abstraction
Instantiating content class attribute0.00000.001120.0000
General
dbfile0.00100.0793100.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs