Add activity to badge awarding
This commit is contained in:
parent
289a8babbb
commit
11151671fc
@ -107,6 +107,30 @@ class BadgeModel extends Gdn_Model {
|
||||
'UserID' => $UserID,
|
||||
'DateInserted' => date(DATE_ISO8601)
|
||||
));
|
||||
|
||||
// Record some activity
|
||||
$Badge = $this->GetBadge($BadgeID);
|
||||
$ActivityModel = new ActivityModel();
|
||||
|
||||
$Activity = array(
|
||||
'ActivityType' => 'BadgeAward',
|
||||
'ActivityUserID' => $UserID,
|
||||
'Photo' => '/uploads/' . $Badge->Photo,
|
||||
'RecordType' => 'Badge',
|
||||
'RecordID' => $BadgeID,
|
||||
'Route' => '/badge/' . $Badge->BadgeID . '/' . Gdn_Format::Url($Badge->Name),
|
||||
'HeadlineFormat' => '{ActivityUserID,user} earned the <a href="{Url,html}">{Data.Name,text}</a> badge.',
|
||||
'Data' => array(
|
||||
'Name' => $Badge->Name
|
||||
),
|
||||
'Story' => $Badge->Description
|
||||
);
|
||||
|
||||
$ActivityModel->Queue($Activity);
|
||||
|
||||
// TODO: Handle notifications
|
||||
|
||||
$ActivityModel->SaveQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,6 @@
|
||||
$Map = Gdn_Autoloader::MAP_LIBRARY;
|
||||
$Context = Gdn_Autoloader::CONTEXT_APPLICATION;
|
||||
$Path = PATH_APPLICATIONS . DS . 'yaga' . DS . 'rules';
|
||||
$Options = array();
|
||||
|
||||
// Set the map options
|
||||
$Options['Extension'] = 'yaga';
|
||||
$Options = array('Extension' => 'yaga', 'ClassFilter' => '*');
|
||||
|
||||
Gdn_Autoloader::RegisterMap($Map, $Context, $Path, $Options);
|
||||
|
@ -52,6 +52,6 @@ $Construct->Table('BadgeAward')
|
||||
->Set($Explicit, $Drop);
|
||||
|
||||
if ($SQL->GetWhere('ActivityType', array('Name' => 'BadgeAward'))->NumRows() == 0)
|
||||
$SQL->Insert('ActivityType', array('AllowComments' => '1', 'Name' => 'BadgeAward', 'FullHeadline' => '%1$s earned the %6$s badge.', 'ProfileHeadline' => '%1$s earned the %6$s badge.', 'Notify' => 1));
|
||||
$SQL->Insert('ActivityType', array('AllowComments' => '1', 'Name' => 'BadgeAward', 'FullHeadline' => '%1$s earned a badge.', 'ProfileHeadline' => '%1$s earned a badge.', 'Notify' => 1));
|
||||
if ($SQL->GetWhere('ActivityType', array('Name' => 'RankPromotion'))->NumRows() == 0)
|
||||
$SQL->Insert('ActivityType', array('AllowComments' => '1', 'Name' => 'RankPromotion', 'FullHeadline' => '%1$s was promoted to %6$s.', 'ProfileHeadline' => '%1$s was promoted to %6$s.', 'Notify' => 1));
|
||||
$SQL->Insert('ActivityType', array('AllowComments' => '1', 'Name' => 'RankPromotion', 'FullHeadline' => '%1$s was promoted.', 'ProfileHeadline' => '%1$s was promoted.', 'Notify' => 1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user