muchas gracias por las respuestas como dice Edson yo agrege:
a download.php
$plugins->run_hooks("download_archive", $archive);
y en thx del plugin agrege:
$plugins->add_hook("download_archive", "thx");
y luego en el plugin thanx deje abajo la funcion:
function thx(&$archive)
{
global $db, $mybb, $lang ,$session, $theme, $altbg, $templates, $thx_cache;
if(!$mybb->settings['thx_active'] || !empty($session->is_spider))
{
return false;
}
$lang->load("thx");
if($b = $archive['dthx'])
{
$entries = build_thank($archive['did'], $b);
}
else
{
$entries = "";
}
if($mybb->user['uid'] != 0 && $mybb->user['uid'] != $archive['uid'])
{
if(!$b)
{
$archive['thanks'] = "<a id=\"a{$archive['did']}\" onclick=\"javascript:return thx({$archive['did']});\" href=\"showthread.php?action=thank&did={$archive['did']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_thx.gif\" border=\"0\" alt=\"$lang->thx_main\" title=\"$lang->thx_main\" id=\"i{$archive['did']}\" /></a>";
}
else if($mybb->settings['thx_del'] == "1")
{
$archive['thanks'] = "<a id=\"a{$archive['did']}\" onclick=\"javascript:return rthx({$archive['did']});\" href=\"showthread.php?action=remove_thank&did={$archive['did']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_rthx.gif\" border=\"0\" alt=\"$lang->thx_remove\" title=\"$lang->thx_remove\" id=\"i{$archive['did']}\" /></a>";
}
else
{
$archive['thanks'] = "<!-- remove thanks disabled by administrator -->";
}
}
$display_style = $entries ? "" : "display:none; border:0;";
$playout = $mybb->settings['postlayout'];
if(!$mybb->settings['thx_outline'])
{
eval("\$archive['thxdsp_inline'] .= \"".$templates->get("thanks_postbit_inline")."\";");
}
else
{
eval("\$archive['thxdsp_outline'] .= \"".$templates->get("thanks_postbit_outline")."\";");
}
if($mybb->settings['thx_count'] == "1")
{
if(!isset($thx_cache['postbit'][$archive['uid']]))
{
$archive['thank_count'] = $archive['thx'];
$archive['thanked_count'] = $lang->sprintf($lang->thx_thanked_count, $archive['thxcount'], $archive['thxdownload']);
eval("\$x = \"".$templates->get("thanks_postbit_count")."\";");
$thx_cache['postbit'][$archive['uid']] = $x;
}
$archive['user_details'] .= $thx_cache['postbit'][$archive['uid']];
}
}
pero no aparece nada

bueno les dejo el thx plugin como lo modifique:
<?php
/*
Plugin Thanks 3.9.1
(c) 2008-2011 by Huji Lee, SaeedGh (SaeehGhMail@Gmail.com)
Last edit: 11-26-2011
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.");
}
if(isset($GLOBALS['templatelist']))
{
$GLOBALS['templatelist'] .= ", thanks_postbit_count";
}
$plugins->add_hook("download_archive", "thx");
$plugins->add_hook("xmlhttp", "do_action");
$plugins->add_hook("download", "direct_action");
function thx_info()
{
return array(
'name' => '<img border="0" src="../images/Thanks.gif" align="absbottom" alt="" /> Thanks',
'description' => 'Add a Thanks button to user posts.',
'website' => 'http://www.mybb.com',
'author' => 'Huji Lee, SaeedGh',
'authorsite' => 'mailto:SaeedGhMail@Gmail.com',
'version' => '3.9.1',
'guid' => 'd82cb3ceedd7eafa8954449cd02a449f',
'compatibility' => '14*,16*'
);
}
function thx_install()
{
global $db;
$db->query("CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."thx (
txid INT UNSIGNED NOT NULL AUTO_INCREMENT,
uid int(10) UNSIGNED NOT NULL,
adduid int(10) UNSIGNED NOT NULL,
did int(10) UNSIGNED NOT NULL,
time bigint(30) NOT NULL DEFAULT '0',
PRIMARY KEY (`txid`),
INDEX (`adduid`, `did`, `time`)
);"
);
if(!$db->field_exists("thx", "users"))
{
$sq[] = "ALTER TABLE ".TABLE_PREFIX."users ADD `thx` INT NOT NULL, ADD `thxcount` INT NOT NULL, ADD `thxdownload` INT NOT NULL";
}
elseif (!$db->field_exists("thxdownload", "users"))
{
$sq[] = "ALTER TABLE ".TABLE_PREFIX."users ADD `thxdownload` INT NOT NULL";
}
if($db->field_exists("thx", "downloads"))
{
$sq[] = "ALTER TABLE ".TABLE_PREFIX."downloads DROP thx";
}
if(!$db->field_exists("dthx", "downloads"))
{
$sq[] = "ALTER TABLE ".TABLE_PREFIX."downloads ADD `dthx` INT(10) NOT NULL DEFAULT '0'";
}
if(is_array($sq))
{
foreach($sq as $q)
{
$db->query($q);
}
}
}
function thx_is_installed()
{
global $db;
if($db->field_exists('thxdownload', "users"))
{
return true;
}
return false;
}
function thx_activate()
{
global $db;
//Update from v3.8
$thx_tbl_keys = $db->query("SHOW KEYS FROM ".TABLE_PREFIX."thx WHERE Key_name='adduid'");
if(!$db->fetch_field($thx_tbl_keys, "Key_name"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."thx ADD INDEX (`adduid`, `did`, `time`)");
}
//Adding templates
require MYBB_ROOT."inc/adminfunctions_templates.php";
find_replace_templatesets("downloads_archives_view", '#'.preg_quote('{$archive[\'downloads\']}</span></td>').'#', '{$archive[\'downloads\']}</span></td><!-- Downloads -->{\$archive[\'thxdsp_inline\']}{$archive[\'thxdsp_outline\']}<!-- /Downloads -->');
find_replace_templatesets("downloads_archives_view", '#'.preg_quote('{$username}').'#', '{$username}{$archive[\'thanks\']}');
find_replace_templatesets("headerinclude", "#".preg_quote('{$newpmmsg}').'#',
'<script type="text/javascript" src="jscripts/thx.js"></script>{$newpmmsg}');
$templatearray = array(
'title' => 'thanks_postbit_count',
'template' => "<div><span class=\"smalltext\">{\$lang->thx_thank} {\$archive[\'thank_count\']}<br />
{\$archive[\'thanked_count\']}<br /></span></div>",
'sid' => '-1',
);
$db->insert_query("templates", $templatearray);
$templatearray = array(
'title' => 'thanks_postbit_inline',
'template' => "<table><tr id=\"thx{\$archive[\'did\']}\" style=\"{\$display_style}\" class=\"trow2 tnx_style tnx_classic\"><td><span class=\"smalltext\">{\$lang->thx_givenby}</span></td><td class=\"trow2 tnx_style\" id=\"thx_list{\$archive[\'did\']}\">\$entries</td></tr></table>",
'sid' => '-1',
);
$db->insert_query("templates", $templatearray);
$templatearray = array(
'title' => 'thanks_postbit_outline',
'template' => "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" id=\"thx{\$archive[\'did\']}\" style=\"{\$display_style};margin-top:5px;\"><tr><td>
<table border=\"0\" cellspacing=\"{\$theme[\'borderwidth\']}\" cellpadding=\"{\$theme[\'tablespace\']}\" class=\"tborder thxdsp_outline\"><tr class=\"trow1 tnx_style\"><td valign=\"top\" width=\"1%\" nowrap=\"nowrap\"><img src=\"{\$mybb->settings[\'bburl\']}/images/rose.gif\" align=\"absmiddle\" /> <span class=\"smalltext\">{\$lang->thx_givenby}</span></td><td class=\"trow2 tnx_style\" id=\"thx_list{\$archive[\'did\']}\">\$entries</td></tr></table>
</td></tr></table>",
'sid' => '-1',
);
$db->insert_query("templates", $templatearray);
$thx_group = array(
"name" => "Thanks",
"title" => "Thanks",
"description" => "Displays thank you note below each post.",
"disporder" => "3",
"isdefault" => "1"
);
$db->insert_query("settinggroups", $thx_group);
$gid = $db->insert_id();
$thx[]= array(
"name" => "thx_active",
"title" => "Activate/Deactivate this plugin",
"description" => "Activate or deactivate plugin but no delete table",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '1',
"gid" => intval($gid),
);
$thx[] = array(
"name" => "thx_count",
"title" => "Show count thanks",
"description" => "Show count thanks in any post",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '2',
"gid" => intval($gid),
);
$thx[] = array(
"name" => "thx_del",
"title" => "Users can remove their thanks",
"description" => "Every one can delete his thanks",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '3',
"gid" => intval($gid),
);
$thx[] = array(
"name" => "thx_hidemode",
"title" => "Show date on mouse over",
"description" => "Show date of thanks just when mouse is over it",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '4',
"gid" => intval($gid),
);
$thx[] = array(
"name" => "thx_autolayout",
"title" => "Auto detect layout",
"description" => "Detect postbit layout and try to correct related HTML code! (just works if \"Separate table\" is ON)",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '5',
"gid" => intval($gid),
);
$thx[] = array(
"name" => "thx_outline",
"title" => "Separate table",
"description" => "If you want to show thanks between of tow post (not in end of a post), switch this option on.",
"optionscode" => "onoff",
"value" => '1',
"disporder" => '6',
"gid" => intval($gid),
);
foreach($thx as $t)
{
$db->insert_query("settings", $t);
}
rebuild_settings();
}
function thx_deactivate()
{
global $db;
require '../inc/adminfunctions_templates.php';
find_replace_templatesets("postbit", '#'.preg_quote('{$archive[\'thxdsp_inline\']}').'#', '', 0);
find_replace_templatesets("postbit", '#'.preg_quote('{$archive[\'thxdsp_outline\']}').'#', '', 0);
find_replace_templatesets("postbit", '#'.preg_quote('{$archive[\'thanks\']}').'#', '', 0);
find_replace_templatesets("postbit_classic", '#'.preg_quote('{$archive[\'thxdsp_inline\']}').'#', '', 0);
find_replace_templatesets("postbit_classic", '#'.preg_quote('{$archive[\'thxdsp_outline\']}').'#', '', 0);
find_replace_templatesets("postbit_classic", '#'.preg_quote('{$archive[\'thanks\']}').'#', '', 0);
find_replace_templatesets("headerinclude", "#".preg_quote('<script type="text/javascript" src="jscripts/thx.js"></script>').'#', '', 0);
$db->delete_query("settings", "name IN ('thx_active', 'thx_count', 'thx_del', 'thx_hidemode', 'thx_autolayout', 'thx_outline')");
$db->delete_query("settinggroups", "name='Thanks'");
$db->delete_query("templates", "title='thanks_postbit_count'");
$db->delete_query("templates", "title='thanks_postbit_inline'");
$db->delete_query("templates", "title='thanks_postbit_outline'");
rebuild_settings();
}
function thx_uninstall()
{
global $db;
/*$db->query("drop TABLE ".TABLE_PREFIX."thx");*/
if($db->table_exists("thx"))
{
$db->drop_table("thx");
}
if($db->field_exists("thx", "users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users DROP thx, DROP thxcount, DROP thxdownload");
}
if($db->field_exists("dthx", "downloads"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."downloads DROP dthx");
}
}
function thx(&$archive)
{
global $db, $mybb, $lang ,$session, $theme, $altbg, $templates, $thx_cache;
if(!$mybb->settings['thx_active'] || !empty($session->is_spider))
{
return false;
}
$lang->load("thx");
if($b = $archive['dthx'])
{
$entries = build_thank($archive['did'], $b);
}
else
{
$entries = "";
}
if($mybb->user['uid'] != 0 && $mybb->user['uid'] != $archive['uid'])
{
if(!$b)
{
$archive['thanks'] = "<a id=\"a{$archive['did']}\" onclick=\"javascript:return thx({$archive['did']});\" href=\"showthread.php?action=thank&did={$archive['did']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_thx.gif\" border=\"0\" alt=\"$lang->thx_main\" title=\"$lang->thx_main\" id=\"i{$archive['did']}\" /></a>";
}
else if($mybb->settings['thx_del'] == "1")
{
$archive['thanks'] = "<a id=\"a{$archive['did']}\" onclick=\"javascript:return rthx({$archive['did']});\" href=\"showthread.php?action=remove_thank&did={$archive['did']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_rthx.gif\" border=\"0\" alt=\"$lang->thx_remove\" title=\"$lang->thx_remove\" id=\"i{$archive['did']}\" /></a>";
}
else
{
$archive['thanks'] = "<!-- remove thanks disabled by administrator -->";
}
}
$display_style = $entries ? "" : "display:none; border:0;";
$playout = $mybb->settings['postlayout'];
if(!$mybb->settings['thx_outline'])
{
eval("\$archive['thxdsp_inline'] .= \"".$templates->get("thanks_postbit_inline")."\";");
}
else
{
eval("\$archive['thxdsp_outline'] .= \"".$templates->get("thanks_postbit_outline")."\";");
}
if($mybb->settings['thx_count'] == "1")
{
if(!isset($thx_cache['postbit'][$archive['uid']]))
{
$archive['thank_count'] = $archive['thx'];
$archive['thanked_count'] = $lang->sprintf($lang->thx_thanked_count, $archive['thxcount'], $archive['thxdownload']);
eval("\$x = \"".$templates->get("thanks_postbit_count")."\";");
$thx_cache['postbit'][$archive['uid']] = $x;
}
$archive['user_details'] .= $thx_cache['postbit'][$archive['uid']];
}
}
function do_action()
{
global $mybb, $lang, $theme;
if(($mybb->input['action'] != "thankyou" && $mybb->input['action'] != "remove_thankyou") || $mybb->request_method != "post")
{
return false;
}
if(file_exists($lang->path."/".$lang->language."/thx.lang.php"))
{
$lang->load("thx");
}
else
{
$l = $lang->language;
$lang->set_language();
$lang->load("thx");
$lang->set_language($l);
}
$did = intval($mybb->input['did']);
if ($mybb->input['action'] == "thankyou" )
{
do_thank($did);
}
else if($mybb->settings['thx_del'] == "1")
{
del_thank($did);
}
$nonead = 0;
$list = build_thank($did, $nonead);
header('Content-Type: text/xml');
$output = "<thankyou>
<list><![CDATA[$list]]></list>
<display>".($list ? "1" : "0")."</display>
<image>{$mybb->settings['bburl']}/{$theme['imgdir']}/";
if($mybb->input['action'] == "thankyou")
{
$output .= "postbit_rthx.gif";
}
else
{
$output .= "postbit_thx.gif";
}
$output .= "</image>
<del>{$mybb->settings['thx_del']}</del>
</thankyou>";
echo $output;
}
function direct_action()
{
global $mybb, $lang;
if($mybb->input['action'] != "thank" && $mybb->input['action'] != "remove_thank")
{
return false;
}
if(file_exists($lang->path."/".$lang->language."/thx.lang.php"))
{
$lang->load("thx");
}
else
{
$l = $lang->language;
$lang->set_language();
$lang->load("thx");
$lang->set_language($l);
}
$did=intval($mybb->input['did']);
if($mybb->input['action'] == "thank" )
{
do_thank($did);
}
else if($mybb->settings['thx_del'] == "1")
{
del_thank($did);
}
redirect($_SERVER['HTTP_REFERER']);
}
function build_thank($did, &$is_thx)
{
global $db, $mybb, $lang, $thx_cache;
$is_thx = 0;
$did = intval($did);
if(file_exists($lang->path."/".$lang->language."/thx.lang.php"))
{
$lang->load("thx");
}
else
{
$l=$lang->language;
$lang->set_language();
$lang->load("thx");
$lang->set_language($l);
}
$dir = $lang->thx_dir;
$query=$db->query("SELECT th.txid, th.uid, th.adduid, th.did, th.time, u.username, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."thx th
JOIN ".TABLE_PREFIX."users u
ON th.adduid=u.uid
WHERE th.did='$did'
ORDER BY th.time ASC"
);
while($record = $db->fetch_array($query))
{
if($record['adduid'] == $mybb->user['uid'])
{
$is_thx++;
}
$date = my_date($mybb->settings['dateformat'].' '.$mybb->settings['timeformat'], $record['time']);
if(!isset($thx_cache['showname'][$record['username']]))
{
$url = get_profile_link($record['adduid']);
$name = format_name($record['username'], $record['usergroup'], $record['displaygroup']);
$thx_cache['showname'][$record['username']] = "<a href=\"$url\" dir=\"$dir\">$name</a>";
}
if($mybb->settings['thx_hidemode'])
{
$entries .= $r1comma." <span title=\"".$date."\">".$thx_cache['showname'][$record['username']]."</span>";
}
else
{
$entries .= $r1comma.$thx_cache['showname'][$record['username']]." <span class=\"smalltext\">(".$date.")</span>";
}
$r1comma = $lang->thx_comma;
}
return $entries;
}
function do_thank($did)
{
global $db, $mybb;
$did = intval($did);
$check_query = $db->simple_select("thx", "count(*) as c" ,"adduid='{$mybb->user['uid']}' AND did='$did'", array("limit"=>"1"));
$tmp=$db->fetch_array($check_query);
if($tmp['c'] != 0)
{
return false;
}
$check_query = $db->simple_select("downloads", "uid", "did='$did'", array("limit"=>1));
if($db->num_rows($check_query) == 1)
{
$tmp=$db->fetch_array($check_query);
if($tmp['uid'] == $mybb->user['uid'])
{
return false;
}
$database = array (
"uid" =>$tmp['uid'],
"adduid" => $mybb->user['uid'],
"did" => $did,
"time" => time()
);
unset($tmp);
$sq = array (
"UPDATE ".TABLE_PREFIX."users SET thx=thx+1 WHERE uid='{$mybb->user['uid']}' LIMIT 1",
"UPDATE ".TABLE_PREFIX."users SET thxcount=thxcount+1, thxdownload=CASE( SELECT COUNT(*) FROM ".TABLE_PREFIX."thx WHERE did='{$did}' LIMIT 1) WHEN 0 THEN thxdownload+1 ELSE thxdownload END WHERE uid='{$database['uid']}' LIMIT 1",
"UPDATE ".TABLE_PREFIX."downloads SET dthx=dthx+1 WHERE did='{$did}' LIMIT 1"
);
foreach($sq as $q)
{
$db->query($q);
}
$db->insert_query("thx", $database);
}
}
function del_thank($did)
{
global $mybb, $db;
$did = intval($did);
if($mybb->settings['thx_del'] != "1")
{
return false;
}
$check_query = $db->simple_select("thx", "`uid`, `txid`" ,"adduid='{$mybb->user['uid']}' AND did='$did'", array("limit"=>"1"));
if($db->num_rows($check_query))
{
$data = $db->fetch_array($check_query);
$uid = intval($data['uid']);
$thxid = intval($data['txid']);
unset($data);
$sq = array (
"UPDATE ".TABLE_PREFIX."users SET thx=thx-1 WHERE uid='{$mybb->user['uid']}' LIMIT 1",
"UPDATE ".TABLE_PREFIX."users SET thxcount=thxcount-1, thxdownload=CASE(SELECT COUNT(*) FROM ".TABLE_PREFIX."thx WHERE did='{$did}' LIMIT 1) WHEN 0 THEN thxdownload-1 ELSE thxdownload END WHERE uid='{$uid}' LIMIT 1",
"UPDATE ".TABLE_PREFIX."downloads SET dthx=dthx-1 WHERE did='{$did}' LIMIT 1"
);
$db->delete_query("thx", "txid='{$thxid}'", "1");
foreach($sq as $q)
{
$db->query($q);
}
}
}
?>