vanilla-application-yaga/library/rules/class.hasmentioned.php

48 lines
1002 B
PHP
Raw Normal View History

<?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) {
2013-11-15 13:56:14 -06:00
$HasMentioned = count($Sender->EventArguments['MentionedUsers']);
if($HasMentioned) {
return TRUE;
}
else {
return FALSE;
}
}
public function Form($Form) {
return '';
}
2013-12-11 16:56:37 -06:00
public function Validate($Criteria, $Form) {
return;
}
public function Hooks() {
2013-11-15 13:56:14 -06:00
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;
}
}