| |
127 |
127 |
db_transaction { |
| |
128 |
128 |
array set user_new_info [auth::create_user -username $user_name -email $email -first_names $first_names -last_name $last_name -password $password] |
| |
129 |
129 |
} |
| |
130 |
130 |
|
| |
131 |
131 |
set admin_user_id [as::actions::get_admin_user_id] |
| |
132 |
132 |
set administration_name [db_string admin_name "select first_names || '' '' || last_name from persons where |
| |
133 |
133 |
person_id = :admin_user_id"] |
| |
134 |
134 |
|
| |
135 |
135 |
set system_name [ad_system_name] |
| |
136 |
136 |
set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""]. |
| |
137 |
137 |
set admin_email [db_string unused "select email from parties where party_id = :admin_user_id"] |
| |
138 |
138 |
set message "$first_names $last_name, |
| |
139 |
139 |
You have been added as a user to $system_name |
| |
140 |
140 |
at $system_url |
| |
141 |
141 |
Login information: |
| |
142 |
142 |
Email: $email |
| |
143 |
143 |
Password: $password |
| |
144 |
144 |
(you may change your password after you log in) |
| |
145 |
145 |
Thank you, |
| |
146 |
146 |
$administration_name" |
| |
147 |
|
ns_sendmail "$email" "$admin_email" "You have been added as a user to [ad_system_name] at [ad_url]" "$message"', |
| |
|
147 |
acs_mail_lite::send -to_addr "$email" -from_addr "$admin_email" -subject "You have been added as a user to [ad_system_name] at [ad_url]" -body "$message"', |
| |
148 |
148 |
context_id => context_id, |
| |
149 |
149 |
creation_user => creation_user |
| |
150 |
150 |
); |
| |
151 |
151 |
|
| |
152 |
152 |
|
| |
153 |
153 |
insert into as_action_params (parameter_id, action_id,type, varname, description) |
| |
154 |
154 |
values (parameter_id_seq.nextval,v_action_id,'n','first_names','First Names of the User'); |
| |
155 |
155 |
|
| |
156 |
156 |
insert into as_action_params (parameter_id, action_id,type, varname, description) |
| |
157 |
157 |
values (parameter_id_seq.nextval,v_action_id,'n','last_name','Last Name of the User'); |
| |
158 |
158 |
|
| |
159 |
159 |
insert into as_action_params (parameter_id, action_id,type, varname, description) |
| |
160 |
160 |
values (parameter_id_seq.nextval,v_action_id,'n','email','Email of the User'); |
| |
161 |
161 |
|
| |
162 |
162 |
insert into as_action_params (parameter_id, action_id,type, varname, description) |
| |
163 |
163 |
values (parameter_id_seq.nextval,v_action_id,'n','user_name','User name of the User'); |
| |
164 |
164 |
|
| |
165 |
165 |
v_action_id:= new ( |
| |
166 |
166 |
action_id => null, |
| |
167 |
167 |
name => 'Event Registration', |
|
| |
179 |
179 |
v_action_id:= new ( |
| |
180 |
180 |
action_id => null, |
| |
181 |
181 |
name => 'Add to Community', |
| |
182 |
182 |
description => 'Add user to a community', |
| |
183 |
183 |
tcl_code => 'set user_id [ad_conn user_id] |
| |
184 |
184 |
if { [exists_and_not_null subject_id] } { |
| |
185 |
185 |
set user_id $subject_id |
| |
186 |
186 |
} |
| |
187 |
187 |
dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t" |
| |
188 |
188 |
dotlrn::user_add -can_browse -user_id $user_id |
| |
189 |
189 |
dotlrn_community::add_user_to_community -community_id $community_id -user_id $user_id |
| |
190 |
190 |
set community_name [db_string get_community_name { select pretty_name from dotlrn_communities where community_id = :community_id}] |
| |
191 |
191 |
|
| |
192 |
192 |
set subject "Your $community_name membership has been approved" |
| |
193 |
193 |
set message "Your $community_name membership has been approved. Please return to [ad_url] to log into [ad_system_name]." |
| |
194 |
194 |
|
| |
195 |
195 |
set email_from [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner] |
| |
196 |
196 |
|
| |
197 |
197 |
db_1row select_user_info { select email, first_names, last_name from registered_users where user_id = :user_id} |
| |
198 |
198 |
|
| |
199 |
|
if [catch {ns_sendmail $email $email_from $subject $message} errmsg] { |
| |
|
199 |
if [catch {acs_mail_lite::send -to_addr $email -from_addr $email_from -subject $subject -body $message} errmsg] { |
| |
200 |
200 |
ad_return_error \ |
| |
201 |
201 |
"Error sending mail" \ |
| |
202 |
202 |
"There was an error sending email to $email." |
| |
203 |
203 |
}', |
| |
204 |
204 |
context_id => context_id, |
| |
205 |
205 |
creation_user => creation_user |
| |
206 |
206 |
); |
| |
207 |
207 |
|
| |
208 |
208 |
|
| |
209 |
209 |
insert into as_action_params (parameter_id, action_id,type, varname, description,query) |
| |
210 |
210 |
values (parameter_id_seq.nextval,v_action_id,'q','community_id','Community to add the user', |
| |
211 |
211 |
'select pretty_name,community_id from dotlrn_communities'); |
| |
212 |
212 |
|
| |
213 |
213 |
|
| |
214 |
214 |
end default_actions; |
| |
215 |
215 |
|
| |
216 |
216 |
end as_action; |
| |
217 |
217 |
/ |
| |
218 |
218 |
show errors; |
| |
219 |
219 |
|