예제 #1
0
        $userid = phorum_db_user_check_field("username", $_REQUEST["adduser"]);
        // load the users groups, add the new group, then save again
        $groups = phorum_user_get_groups($userid);
        // make sure the user isn't already a member of the group
        if (!isset($groups[$PHORUM["args"]["group"]])){
            $groups[$PHORUM["args"]["group"]] = PHORUM_USER_GROUP_APPROVED;
            phorum_user_save_groups($userid, $groups);
            $PHORUM["DATA"]["Message"] = $PHORUM["DATA"]["LANG"]["UserAddedToGroup"];
        }
    }

    // if changing the existing members of the group
    if (isset($_REQUEST["status"])){
        foreach ($_REQUEST["status"] as $userid => $status){
            // load the users groups, make the change, then save again
            $groups = phorum_user_get_groups($userid);
            // we can't set someone to be a moderator from here
            if ($status != PHORUM_USER_GROUP_MODERATOR){
                $groups[$PHORUM["args"]["group"]] = $status;
            }
            if ($status == PHORUM_USER_GROUP_REMOVE){
                unset($groups[$PHORUM["args"]["group"]]);
            }
            phorum_user_save_groups($userid, $groups);
        }
        $PHORUM["DATA"]["Message"] = $PHORUM["DATA"]["LANG"]["ChangesSaved"];
    }

    $group = phorum_db_get_groups($PHORUM["args"]["group"]);
    $PHORUM["DATA"]["GROUP"]["name"] = $group[$PHORUM["args"]["group"]]["name"];        
    $PHORUM["DATA"]["USERS"] = array();
예제 #2
0
/**
 * phorum_user_get_moderator_groups()
 *
 * This function will return a list of the groups the current user
 * is allowed to moderate. For admins, this will return all the groups.
 *
 * The array is of the form array[group_id] = groupname.
 * @return array
 */
function phorum_user_get_moderator_groups()
{
    $PHORUM=$GLOBALS["PHORUM"];
    $groups = array();
    $fullgrouplist = phorum_db_get_groups();

    // if its an admin, return all groups as a moderator
    if ($PHORUM["user"]["admin"]){
        // the permission here is for a forum, we don't care about that
        foreach ($fullgrouplist as $groupid => $groupperm){
            $groups[$groupid] = $fullgrouplist[$groupid]["name"];
        }
    }
    else {
        $grouplist = phorum_user_get_groups($PHORUM["user"]["user_id"]);
        foreach ($grouplist as $groupid => $perm){
            if ($perm == PHORUM_USER_GROUP_MODERATOR){
                $groups[$groupid] = $fullgrouplist[$groupid]["name"];
            }
        }
    }
    return $groups;
}
예제 #3
0
            $frm->hidden("module", "users");

            $frm->hidden("section", "groups");

            $extra_opts = "";
            // if its an admin, let the user know that the admin will be able to act as a moderator no matter what
            if ($user["admin"]){
                $row=$frm->addbreak("Edit Groups (Admins can act as a moderator of every group, regardless of these values)");
            }
            else{
                $row=$frm->addbreak("Edit Groups");
            }

            $groups= phorum_db_get_groups();
            $usergroups = phorum_user_get_groups($_REQUEST["user_id"]);

            $arr=array("Add A Group...");
            foreach($groups as $group_id=>$group){
                if(!isset($usergroups[$group_id]))
                    $arr[$group_id]=$group["name"];
            }

            if(count($arr)>1)
                $frm->addrow("Add A Group", $frm->select_tag("new_group", $arr));

            if(is_array($usergroups)){
                $group_options = array(PHORUM_USER_GROUP_REMOVE => "< Remove User From Group >",
                        PHORUM_USER_GROUP_SUSPENDED => "Suspended",
                        PHORUM_USER_GROUP_UNAPPROVED => "Unapproved",
                        PHORUM_USER_GROUP_APPROVED => "Approved",
예제 #4
0
function phorum_joinable_groups()
{
    $PHORUM = $GLOBALS["PHORUM"];
    $joinablegroups = array();
    $groups = phorum_db_get_groups();
    $memberof = phorum_user_get_groups($PHORUM["user"]["user_id"]);
    foreach ($groups as $group){
        if (!isset($memberof[$group["group_id"]])){
            if ($group["open"] == PHORUM_GROUP_OPEN){
                $joinablegroups[] = array("group_id" => $group["group_id"], "name" => $group["name"]);
            }
            elseif ($group["open"] == PHORUM_GROUP_REQUIRE_APPROVAL){
                $joinablegroups[] = array("group_id" => $group["group_id"], "name" => $group["name"] . " (*)");
            }
        }
    }
    return $joinablegroups;
}