Forum OpenACS Q&A: Using other member states in dotLRN

Collapse
Posted by Nima Mazloumi on
Hi all,

not sure wether others use the available member state like banned, deleted, rejected. Below what you might be able to do in case you only use use dotlrn_member_rel and dotlrn_admin_rel.

set rel_type "dotlrn_member_rel"
if {[::xo::db::sql::dotlrn_community admin_p -community_id $community_id  -party_id $member_id] eq "t"} {
 set rel_tyle "dotlrn_admin_rel"
}

set rel_id [relation::get_id -object_id_one $community_id -object_id_two $member_id -rel_type $rel_type]

if {$rel_id ne ""} {
 #set user to deleted state
 membership_rel::change_state -state "deleted" -rel_id $rel_id
 dotlrn_community::applets_dispatch  -community_id $community_id  -op RemoveUserFromCommunity -list_args [list $community_id $uid]

 #revert to approved
 membership_rel::change_state -state "approved" -rel_id $rel_id
 dotlrn_community::applets_dispatch  -community_id $community_id  -op AddUserToCommunity -list_args [list $community_id $uid]
}
Not sure if this has side-effects. Again, we don't use that in production.