(ultimate points mod required)
very simple code additions. allowing to add poins if admin give thanks. (remove IF construction if u want to allow points adds when anybody thanks post)
in functions_thanks.php
1. find (add thanks)
Code: Select all
$sql = 'INSERT INTO ' . THANKS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => $user_id,
'post_id' => $post_id,
'poster_id' => $to_id,
'topic_id' => $row['topic_id'],
'forum_id' => $row['forum_id'],
'thanks_time' => time()
));
$db->sql_query($sql);
insert after
Code: Select all
if ($user_id == 2)
{
$thanks_points=10;
$sql = "UPDATE " . USERS_TABLE . "
SET user_points = user_points + $thanks_points
WHERE user_id = $to_id" ;
$db->sql_query($sql);
}
2. find (off)
Code: Select all
$sql = "DELETE FROM " . THANKS_TABLE . '
WHERE post_id ='. (int) $post_id ." AND user_id = " . $user->data['user_id'];
$db->sql_query($sql);
insert after
Code: Select all
if ($user_id == 2)
{
$thanks_points=10;
$sql = "UPDATE " . USERS_TABLE . "
SET user_points = user_points - $thanks_points
WHERE user_id = $to_id" ;
$db->sql_query($sql);
}
where $thanks_points=10; - points for action