Forums / Developer / My login page

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