vanilla-application-yaga/library/rules/class.hasmentioned.php
Zachary Doll c0d11cf91e Interaction rules are now checked on all hooks
Added an Interacts method on the yagarule interface. Any badges using
interactive rules will be checked regardless of the calling user's award
status. Fixes issue #15
2014-02-19 08:48:21 -06:00

48 lines
1002 B
PHP

<?php if(!defined('APPLICATION')) exit();
/**
* This rule awards badges when a user mentions another user in a discussion,
* comment, or activity
*
* @author Zachary Doll
* @since 1.0
* @package Yaga
*/
class HasMentioned implements YagaRule{
public function Award($Sender, $User, $Criteria) {
$HasMentioned = count($Sender->EventArguments['MentionedUsers']);
if($HasMentioned) {
return TRUE;
}
else {
return FALSE;
}
}
public function Form($Form) {
return '';
}
public function Validate($Criteria, $Form) {
return;
}
public function Hooks() {
return array('CommentModel_BeforeNotification', 'DiscussionModel_BeforeNotification');
}
public function Description() {
$Description = T('Yaga.Rules.HasMentioned.Desc');
return Wrap($Description, 'div', array('class' => 'InfoMessage'));
}
public function Name() {
return T('Yaga.Rules.HasMentioned');
}
public function Interacts() {
return FALSE;
}
}