You can set in wanted forums with this hack, an option which displays in a special post of a thread, the list of members who clicked the 'Thank you' button. So, instead of having a lot of posts saying : 'Great', 'Big thx ' ... you only have one post.
The postbit (legacy or not) automatically adapts itself too.
The phrase to thank the thread creator change if there is one user or more which clicks the button, so the verb is always correct
There is an other option too in Forum manager, to set if you want to see at which date the 'Thank you' button was clicked by the member.
Thanks VBDev, but it didn't work at all. I gave up. Have no ideas about this error.
Try many times and may different ways, but still didn't work at all.
Quote:
Originally Posted by VBDev
@ 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
I'm only getting the "no permission" error only on those forums where the "thank you" has not been activated on admincp, but on those where it was is working perfect.
I'm only getting the "no permission" error only on those forums where the "thank you" has not been activated on admincp, but on those where it was is working perfect.
Just add this above the code in the template for the thank you button:
HTML Code:
<if condition="$forum['showthanks']">
and add this below the code in the template for the thank you button:
HTML Code:
</if>
and the button will only show on the forums it is set for.
How about a hack that would SHOW in the Users profile how many Thank You's one has made? Along the SAME lines as when they make a Post? I know others that would LOVE this feature.
Is there soemothing out there that could be ADDED to show this?
1 - Only add it once in your SHOWTHREAD template, you added it twice
2 - I only modify the functions_showpost.php to add my thank function, I don't think the problem come from the hack