I'd like to give users extra points if they include an http link in their comments. (Specifically, a link to the official documentation website in our company.) How can I make this happen with a plugin? (Or can it be done without a plugin?)
I was able to write an "event" plugin (code below) and have two questions:
-
How do I add the points to the user?
-
How do I add a new type of points (say, called "Doc Link Points") to the Points Administration Page, and retrieve those points in the plugin?
Plugin code is:
class extrapoints {
function process_event($event, $userid, $handle, $cookieid, $params) {
if ($event == 'c_post'
&& isset($params)
&& isset($params['text'])
&& $this->is_wiki_link($params['text'])) {
// Retrieve the right number of "Doc Link" points here!
// Add the points for user $userid here!
}
}
function is_wiki_link($text) {
return preg_match('@http://docs.example.com/@i',
$text) > 0;
}
}