I remember reading a post on here that someone wanted to do this..
Here's the code you will need to customize it based on the email message you want to send out.
In your sources/karma.php
Add this function
// Send the karma person a lovely email.
function emailKarma($template, $replacements = array(), $additional_recipients = array())
{
global $smcFunc, $sourcedir, $user_info;
// We certainly want this.
require_once($sourcedir . '/Subs-Post.php');
$request = $smcFunc['db_query']('', '
SELECT id_member, member_name, real_name, email_address
FROM {db_prefix}members
WHERE (id_member = ' . $_REQUEST['uid'] . ' )');
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$headers = 'PHP Help' . "\r\n";
// Then send the actual email.
sendmail($row['email_address'], $user_info['username'] . ' just gave you Karma on PHPHelp.com', $user_info['username'] . ' thought one of your posts was worthy of good karma! Thanks for contributing at www.phphelp.com/forum/', $headers);
}
$smcFunc['db_free_result']($request);
}
Next Find this..
// Change by one.
updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karma_good' : 'karma_bad' => '+'));
And under it add this.
//Send member an email here that's being updated.
emailKarma();
I moved this over to the right forum. :)
Thanks, I didn't know where to post my minor mods! I do now!
Can a user opt out of that as it can be annoying if a posts gets dozens of Karma's.
Not the way it's currently coded, would need to build it into the notification system, I didn't think about that.
No worries in our case because only the moderators can give Karma in our forum and we are not liberal with that.
I am sorry for not saying thank you in my post above for your neat idea. :-[
After we fix some stability issues we will give your script a try & report here.
Very nice!
Very good. Keeps people coming back to the forum
Is it possible to have this activated just for particular users? I don't want that every user on our forum get this mail, but I would like that my administrators get it?
http://custom.simplemachines.org/mods/index.php?mod=192