Move the foreach applet command after the community clone command. We got an error, because the clone proc tried to create the community applets before the new community was created (clone community).
users in classes were labeled with dotlrn_member_rel if they were not added from the class administratio page. This caused issues with bulk-mailing them by role. Includes upgrade script to properly label these users as dotlrn_student_rel