Index: openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql	9 Jun 2005 19:19:47 -0000	1.8
+++ openacs-4/packages/assessment/sql/postgresql/assessment-actions-create.sql	12 Jun 2006 02:49:50 -0000	1.9
@@ -221,9 +221,27 @@
 	''Add to Community'',
 	''Add user to a community'',
 	''set user_id [ad_conn user_id]
+if { [exists_and_not_null subject_id] } {
+	set user_id $subject_id
+} 
 dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t"
 dotlrn::user_add -can_browse  -user_id $user_id
-dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id'',
+dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id
+
+set community_name [db_string get_community_name { select pretty_name from dotlrn_communities where community_id = :community_id}]
+
+set subject "Your $community_name membership has been approved"
+set message "Your $community_name membership has been approved. Please return to [ad_url] to log into [ad_system_name]."
+
+set email_from [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner]
+
+db_1row select_user_info { select email, first_names, last_name from registered_users where user_id = :user_id}
+
+if [catch {ns_sendmail $email $email_from $subject $message} errmsg] {
+         ad_return_error \
+        "Error sending mail" \
+        "There was an error sending email to $email."
+}'',
 	new__package_id,
 	new__creation_user,
 	new__package_id
