#
#  Copyright (C) 2001, 2002 MIT
#
#  This file is part of dotLRN.
#
#  dotLRN is free software; you can redistribute it and/or modify it under the
#  terms of the GNU General Public License as published by the Free Software
#  Foundation; either version 2 of the License, or (at your option) any later
#  version.
#
#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
#  details.
#

ad_page_contract {
    approve

    @author yon (yon@openforce.net)
    @creation-date 2002-03-15
    @version $Id: approve.tcl,v 1.8 2006/08/08 21:26:23 donb Exp $
} -query {
    {user_id:multiple ""}
    {community_id ""}
    {referer "./"}
}

ad_maybe_redirect_for_registration

if {[empty_string_p $community_id]} {
    set community_id [dotlrn_community::get_community_id]
}

foreach uid $user_id {
    if {[empty_string_p $uid]} {
	    set uid [ad_conn user_id]
    } else {
	    dotlrn::require_user_admin_community -community_id $community_id
    }
    
    dotlrn_community::membership_approve -community_id $community_id -user_id $uid
}

ad_returnredirect $referer

