Switch to after get session for status based rules.
This commit is contained in:
parent
6624b1c97d
commit
61026d28bf
@ -62,7 +62,7 @@ class CommentCount implements YagaRule{
|
||||
$Form->SetValidationResults($Validation->Results());
|
||||
}
|
||||
public function Hooks() {
|
||||
return array('CommentModel_AfterSaveComment');
|
||||
return array('Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function Description() {
|
||||
|
@ -63,7 +63,7 @@ class DiscussionCount implements YagaRule{
|
||||
}
|
||||
|
||||
public function Hooks() {
|
||||
return array('DiscussionModel_AfterSaveDiscussion');
|
||||
return array('Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function Description() {
|
||||
|
@ -54,7 +54,7 @@ class HolidayVisit implements YagaRule {
|
||||
}
|
||||
|
||||
public function Hooks() {
|
||||
return array('Base_AfterSignIn');
|
||||
return array('Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function Description() {
|
||||
|
@ -49,7 +49,7 @@ class LengthOfService implements YagaRule {
|
||||
}
|
||||
|
||||
public function Hooks() {
|
||||
return array('Base_AfterSignIn');
|
||||
return array('Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function Description() {
|
||||
|
@ -27,7 +27,7 @@ class PhotoExists implements YagaRule {
|
||||
}
|
||||
|
||||
public function Hooks() {
|
||||
return array('UserModel_AfterSave');
|
||||
return array('Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function Description() {
|
||||
|
@ -3,14 +3,14 @@
|
||||
$ApplicationInfo['Yaga'] = array(
|
||||
'Name' => 'Yet Another Gamification Application',
|
||||
'Description' => 'Yaga provides customizable reactions, badges, and ranks for your Vanilla forum software. Increase user activity by letting users react to content with emotions. Give users badges based on statistics and engagement in your community. Create and award custom badges for special events and recognition. Award Ranks which can confer different (configurable) permissions based on community perception and participation.',
|
||||
'Version' => '0.3.3',
|
||||
'Url' => 'http://github.com/hgtonight/application-yaga',
|
||||
'Version' => '0.3.4',
|
||||
'Url' => 'http://github.com/hgtonight/application-yaga',
|
||||
'Author' => 'Zachary Doll',
|
||||
'AuthorEmail' => 'hgtonight@daklutz.com',
|
||||
'AuthorUrl' => 'http://www.daklutz.com',
|
||||
'License' => 'GPLv3',
|
||||
'SettingsUrl' => '/settings/yaga',
|
||||
'SettingsPermission' => 'Garden.Settings.Manage',
|
||||
'SettingsPermission' => 'Garden.Settings.Manage',
|
||||
|
||||
// Application requirements
|
||||
'RequiredApplications' => array('Vanilla' => '2.1b2'),
|
||||
|
@ -419,6 +419,10 @@ class YagaHooks implements Gdn_IPlugin {
|
||||
/**
|
||||
* Check for Badge Awards where appropriate
|
||||
*/
|
||||
public function Base_AfterGetSession_Handler($Sender) {
|
||||
$this->_AwardBadges($Sender, 'Base_AfterGetSession');
|
||||
}
|
||||
|
||||
public function CommentModel_AfterSaveComment_Handler($Sender) {
|
||||
$this->_AwardBadges($Sender, 'CommentModel_AfterSaveComment');
|
||||
}
|
||||
@ -465,7 +469,13 @@ class YagaHooks implements Gdn_IPlugin {
|
||||
if(!C('Yaga.Badges.Enabled') || !$Session->IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(Debug()) {
|
||||
$Controller = Gdn::Controller();
|
||||
if($Controller) {
|
||||
$Controller->InformMessage("Checking for awards on $Hook");
|
||||
}
|
||||
}
|
||||
$UserID = $Session->UserID;
|
||||
$UserModel = new UserModel();
|
||||
$User = $UserModel->GetID($UserID);
|
||||
|
Loading…
x
Reference in New Issue
Block a user