Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Feature Request] Mentioning something as a Rule for Badges
This discussion is related to the Yet Another Gamification Application addon.
Comments
You want a rule that parses the message for a word? Maybe a keyword rule?
You should write it up as an exercise. I will get you started.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Let me introduce myself: Hi, I'm a cheater.
I will try that @hgtonight
@hgtonight After saving the code as class.keyword.php and saved it in /applications/yaga/library/rules, it gives me a "Rule Not Found" error
I got around it by renaming class.keyword.php to class.keywordused.php, and got it setup, but now, when I say "Hi" in a comment / discussion, it doesn't award it to me automatically
You will have to write the actual parsing code yourself as an exercise. Line 10 of your rule file should read
// insert logic here
.Have at it.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight Just one thing: What does $SQL do? How does it connect to the database if it does? I need the parsing code to pull data from the database.
EDIT: Nvm about the above question. What table does Vanilla store comments?
$SQL is generally a Gdn_SQLDriver object.
Read through
/library/database/class.sqldriver.php
to learn what it can do.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Maybe this?
public function Award($Sender, $User, $Criteria) {
$connect = mysqli_connect("localhost","*******","******","*******")
$result = mysqli_query($connect,"SELECT * FROM GDN_Comment")
if $result includes "Hi" then
return TRUE;
else
return FALSE
Maybe not complete, but is this ok for the base, before the award assigning code adds on?
You don't need to deal with connecting to the db at all. The comment or discussion is already loaded in the calling object ($Sender).
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I need to change my password... Can you edit that to delete the password and personal info please @hgtonight?
What about this?
public function Award($Sender, $User, $Criteria) {
if $Sender include "Hi" then
return TRUE;
@hgtonight Did you add the code to automatically give out badges yet?
EDIT: Along with the parsing code I did