I run the code bellow in the shell at my website:
***************************************
set user_name "test-2006-06-22-22-00"
set first_names "test-2006-06-22-22-00"
set last_name "test-2006-06-22-22-00"
set email "mailto:iuri_sampaio@hotmail.com";
set country "brazil"
set password [ad_generate_random_string]
db_transaction {
array set user_new_info [auth::create_user -username user_name -email email -first_names first_names -last_name last_name -password password]
}
set user_id $user_new_info(user_id)
dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t"
dotlrn::user_add -can_browse -user_id $user_id
set admin_user_id [as::actions::get_admin_user_id]
set administration_name [db_string admin_name "select first_names || ' ' || last_name from persons where person_id = :admin_user_id"]
set system_name [ad_system_name]
set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""].
set admin_email [db_string unused "select email from parties where party_id = :admin_user_id"]
set message "$first_names $last_name,
You have been added as a user to $system_name
at $system_url
Login information:
Email: $email
Password: $password
(you may change your password after you log in)
Thank you,
$administration_name"
ns_sendmail "$email" "$admin_email" "You have been added as a user to [ad_system_name] at [ad_url]" "$message"
db_dml insert_country {insert into tbl_countries (parent_user_id, country_name) values (:user_id, :country)}
************************
and i got the follow error message:
************************
ERROR:
can't read "user_new_info(user_id)": no such element in array
while executing
"set user_id $user_new_info(user_id)
"
("uplevel" body line 11)
invoked from within
"uplevel 1 $script"
*****************************
I already checked the proc ad::create_user on API docs. I see user_id is generated by the code. I don;t need to declare it.
So why the error is happening?