Adding karma.

This commit is contained in:
JT Smith 2002-06-23 22:37:24 +00:00
parent 8a6b95b612
commit 06b64fc226
2 changed files with 11 additions and 5 deletions

View file

@ -81,7 +81,11 @@ sub www_editGroup {
$f->text("groupName",WebGUI::International::get(84),$group{groupName});
$f->textarea("description",WebGUI::International::get(85),$group{description});
$f->integer("expireAfter",WebGUI::International::get(367),$group{expireAfter});
$f->integer("karmaThreshold",WebGUI::International::get(538),$group{karmaThreshold});
if ($session{setting}{useKarma}) {
$f->integer("karmaThreshold",WebGUI::International::get(538),$group{karmaThreshold});
} else {
$f->hidden("karmaThreshold",$group{karmaThreshold});
}
$f->submit;
$output .= $f->print;
unless ($session{form}{gid} eq "new") {

View file

@ -137,11 +137,13 @@ sub isInGroup {
### Get data for auxillary checks.
tie %group, 'Tie::CPHash';
%group = WebGUI::SQL->quickHash("select karmaThreshold from groups where groupId='$gid'");
tie %user, 'Tie::CPHash';
%user = WebGUI::SQL->quickHash("select karma from users where userId='$uid'");
### Check karma levels.
if ($user{karma} >= $group{karmaThreshold}) {
return 1;
if ($session{setting}{useKarma}) {
tie %user, 'Tie::CPHash';
%user = WebGUI::SQL->quickHash("select karma from users where userId='$uid'");
if ($user{karma} >= $group{karmaThreshold}) {
return 1;
}
}
### Admins can do anything!
if ($gid != 3) {