Index: openacs-4/packages/acs-subsite/www/members/user-batch-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/members/user-batch-add-2.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-subsite/www/members/user-batch-add-2.tcl 19 Mar 2004 13:09:35 -0000 1.1.2.1 +++ openacs-4/packages/acs-subsite/www/members/user-batch-add-2.tcl 5 May 2004 09:40:15 -0000 1.1.2.2 @@ -21,6 +21,8 @@ set success_text "" set title "Adding new users in bulk" +set group_id [application_group::group_id_from_package_id] + # parse the userlist input a row at a time # most errors stop the processing of the line but keep going on the # bigger block @@ -37,11 +39,18 @@ append exception_text "
  • Couldn't find a valid email address in ($row).
  • \n" continue } else { - set email_count [db_string unused "select count(email) -from parties where email = lower(:email)"] + set user_exists_p [db_0or1row user_id "select party_id from parties where email = lower(:email)"] - if {$email_count > 0} { + if {$user_exists_p > 0} { + + # Add user to subsite as a member + + group::add_member \ + -group_id $group_id \ + -user_id $party_id + append exception_text "
  • $email was already in the database.
  • \n" + continue } } @@ -65,13 +74,21 @@ set user_id $auth_status_array(user_id) append success_text "Created user $user_id for ($row)" + + + # Add user to subsite as a member + group::add_member \ + -group_id $group_id \ + -user_id $user_id + # if anything goes wrong here, stop the whole process if { !$user_id } { ad_return_error "Insert Failed" "We were unable to create a user record for ($row)." ad_script_abort } - + + # send email set key_list [list first_names last_name email password]