Forum .LRN Q&A: Re: "Unarchives a community. ** not done yet **"

Collapse
Posted by Cato Kolås on
The following code seems to work (notice the rel_segments_grant_permission as its also needed):

ad_proc -public unarchive {
    {-community_id:required}
} {
    Unarchives a community.
} {
  #error
  #ad_script_abort
  db_dml update_archive_p {}
  rel_segments_grant_permission -community_id $community_id
}

FYI: Just an addendum (found that some more code is need to complete it - I hope :)

dotlrn/tcl/community-procs.tcl:

ad_proc -public unarchive {
    {-community_id:required}
} {
  Unarchives a community.
} {
        db_dml update_archive_p {}

    rel_segments_grant_permission -community_id $community_id

    # Must also execute AddUserToCommunity
    foreach user [list_users $community_id] {
        set user_id [ns_set get $user user_id]
        applets_dispatch \
        -community_id $community_id \
        -op AddUserToCommunity \
        -list_args [list $community_id $user_id]
    }
}