@ calvin : I've exactly the same problem ... this no_permission page, really strange, the var $foruminfo[showthanks] doesn't seen working
I correct it before doing the counter
If you have this no_permission problem, replace the code to add in newreply.php with :
PHP Code:
// ############################### Than you hack Grog6 ###############################
if ($_REQUEST['do'] == 'thanks')
{
globalize($_REQUEST, array('threadid' => INT));
$forum=$DB_site->query_first("SELECT showthanks FROM ". TABLE_PREFIX ."forum WHERE forumid='$foruminfo[forumid]'");
if ($forum[showthanks]==0 || $bbuserinfo[userid]==0)
print_no_permission();
else
{
$verif=$DB_site->query_first("SELECT userid FROM ". TABLE_PREFIX ."thanks WHERE threadid='$threadid' AND userid='$bbuserinfo[userid]'");
if ($verif[userid]==$bbuserinfo[userid])
eval(print_standard_error('error_already_thanks'));
else
{
$DB_site->query("
INSERT INTO ". TABLE_PREFIX ."thanks
(userid, username, date, threadid)
VALUES ('$bbuserinfo[userid]', '" . addslashes($bbuserinfo[username]) . "', " . TIMENOW . ", '$threadid')");
$url = "showthread.php?$session[sessionurl]t=$threadid";
eval(print_standard_redirect('redirect_thanks'));
}
}
}
And code to add in functions_showthread.php with :
PHP Code:
// thank you hack grog6
$cmpt=1;
$grumpf=$DB_site->query_first("SELECT showthanks FROM ". TABLE_PREFIX ."forum WHERE forumid='$forum[forumid]'");
if ($grumpf[showthanks] == 1 && $post[postcount]==1)
{
$thanks=$DB_site->query("SELECT * FROM ". TABLE_PREFIX ."thanks WHERE threadid='$thread[threadid]' ORDER BY username");
$nb=$DB_site->num_rows($thanks);
if ($nb>0)
{
while($thank=$DB_site->fetch_array($thanks))
{
if ($cmpt<$nb)
$virg=",";
else $virg="";
if ($forum[showthanks_date]==0)
$liste_user = $liste_user." <a href=\"member.php?u=$thank[userid]\">$thank[username]</a>$virg ";
else
{
$date_thank = vbdate($vboptions['dateformat'], $thank['date'], true);
$liste_user = $liste_user." <a href=\"member.php?u=$thank[userid]\">$thank[username]</a> ($date_thank)$virg ";
}
$date=$thank[date];
$cmpt++;
}
// format date/time
$post['postdate'] = vbdate($vboptions['dateformat'], $date, true);
$post['posttime'] = vbdate($vboptions['timeformat'], $date);
// user profil field
$username = "<b><font size=\"3\">$vbphrase[thanks_bot]</font></b>";
if ($nb<=1)
$thank_phrase = construct_phrase($vbphrase[thanks_1_install], $post[musername]);
else $thank_phrase = construct_phrase($vbphrase[thanks_x_install], $post[musername]);
if ($vboptions[legacypostbit]=="000")
eval('$thanks_post .= " ' . fetch_template('thanks_postbit') . '";');
else eval('$thanks_post = " ' . fetch_template('thanks_postbit_legacy') . '";');
}
}
// thank you hack grog6