Support awarding multiple users with a single award.

This commit is contained in:
Zachary Doll 2014-12-15 12:38:35 -06:00
parent b374691fab
commit 51e41cc3d3

View File

@ -726,13 +726,20 @@ class YagaHooks implements Gdn_IPlugin {
$Criteria = (object) unserialize($Badge->RuleCriteria);
$Result = $Rule->Award($Sender, $User, $Criteria);
if($Result) {
if(is_numeric($Result)) {
$AwardedUserID = $Result;
$AwardedUserIDs = array();
if(is_array($Result)) {
$AwardedUserIDs = $Result;
}
else if(is_numeric($Result)) {
$AwardedUserIDs[] = $Result;
}
else {
$AwardedUserID = $UserID;
$AwardedUserIDs[] = $UserID;
}
foreach($AwardedUserIDs as $AwardedUserID) {
$BadgeAwardModel->Award($Badge->BadgeID, $AwardedUserID, $UserID);
}
$BadgeAwardModel->Award($Badge->BadgeID, $AwardedUserID, $UserID);
}
}
}