Switch to after get session for status based rules.

This commit is contained in:
Zachary Doll 2014-01-30 08:36:06 -06:00
parent 6624b1c97d
commit 61026d28bf
7 changed files with 19 additions and 9 deletions

View File

@ -62,7 +62,7 @@ class CommentCount implements YagaRule{
$Form->SetValidationResults($Validation->Results()); $Form->SetValidationResults($Validation->Results());
} }
public function Hooks() { public function Hooks() {
return array('CommentModel_AfterSaveComment'); return array('Base_AfterGetSession');
} }
public function Description() { public function Description() {

View File

@ -63,7 +63,7 @@ class DiscussionCount implements YagaRule{
} }
public function Hooks() { public function Hooks() {
return array('DiscussionModel_AfterSaveDiscussion'); return array('Base_AfterGetSession');
} }
public function Description() { public function Description() {

View File

@ -54,7 +54,7 @@ class HolidayVisit implements YagaRule {
} }
public function Hooks() { public function Hooks() {
return array('Base_AfterSignIn'); return array('Base_AfterGetSession');
} }
public function Description() { public function Description() {

View File

@ -49,7 +49,7 @@ class LengthOfService implements YagaRule {
} }
public function Hooks() { public function Hooks() {
return array('Base_AfterSignIn'); return array('Base_AfterGetSession');
} }
public function Description() { public function Description() {

View File

@ -27,7 +27,7 @@ class PhotoExists implements YagaRule {
} }
public function Hooks() { public function Hooks() {
return array('UserModel_AfterSave'); return array('Base_AfterGetSession');
} }
public function Description() { public function Description() {

View File

@ -3,14 +3,14 @@
$ApplicationInfo['Yaga'] = array( $ApplicationInfo['Yaga'] = array(
'Name' => 'Yet Another Gamification Application', '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.', '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', 'Version' => '0.3.4',
'Url' => 'http://github.com/hgtonight/application-yaga', 'Url' => 'http://github.com/hgtonight/application-yaga',
'Author' => 'Zachary Doll', 'Author' => 'Zachary Doll',
'AuthorEmail' => 'hgtonight@daklutz.com', 'AuthorEmail' => 'hgtonight@daklutz.com',
'AuthorUrl' => 'http://www.daklutz.com', 'AuthorUrl' => 'http://www.daklutz.com',
'License' => 'GPLv3', 'License' => 'GPLv3',
'SettingsUrl' => '/settings/yaga', 'SettingsUrl' => '/settings/yaga',
'SettingsPermission' => 'Garden.Settings.Manage', 'SettingsPermission' => 'Garden.Settings.Manage',
// Application requirements // Application requirements
'RequiredApplications' => array('Vanilla' => '2.1b2'), 'RequiredApplications' => array('Vanilla' => '2.1b2'),

View File

@ -419,6 +419,10 @@ class YagaHooks implements Gdn_IPlugin {
/** /**
* Check for Badge Awards where appropriate * Check for Badge Awards where appropriate
*/ */
public function Base_AfterGetSession_Handler($Sender) {
$this->_AwardBadges($Sender, 'Base_AfterGetSession');
}
public function CommentModel_AfterSaveComment_Handler($Sender) { public function CommentModel_AfterSaveComment_Handler($Sender) {
$this->_AwardBadges($Sender, 'CommentModel_AfterSaveComment'); $this->_AwardBadges($Sender, 'CommentModel_AfterSaveComment');
} }
@ -466,6 +470,12 @@ class YagaHooks implements Gdn_IPlugin {
return; return;
} }
if(Debug()) {
$Controller = Gdn::Controller();
if($Controller) {
$Controller->InformMessage("Checking for awards on $Hook");
}
}
$UserID = $Session->UserID; $UserID = $Session->UserID;
$UserModel = new UserModel(); $UserModel = new UserModel();
$User = $UserModel->GetID($UserID); $User = $UserModel->GetID($UserID);