Answer the question
In order to leave comments, you need to log in
Automatic registration when ordering. How to add a birthday date to a user profile?
Good afternoon!
Added string property Date to order properties. The mnemonic code is BIRTHDAY.
How to add this field to the user account during automatic registration?
I use the event handler OnAfterUserAdd
AddEventHandler(
"main",
"OnAfterUserAdd",
"OnAfterUserAddHandler"
);
function OnAfterUserAddHandler(&$arFields) {
if ( !empty( $arFields["BIRTHDAY"] ) ) {
$user = new CUser;
$fields = Array( "PERSONAL_BIRTHDAY" => $arFields["BIRTHDAY"], );
$user->Update( $arFields["ID"] , $fields );
}
}
Answer the question
In order to leave comments, you need to log in
There is an elegant crutch. On the order creation event, write the date to the session, for example, in the field REGISTER_AND_LOGIN_PERSONAL_BIRTHDAY
, on the prologue event, check for non-emptiness of this field in the session, if it exists, then write it to the user account and delete this field from the session.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question