2014-08-25, 09:04 PM
Hey Wildcard,
I am using the thankyou/like plugin, and I found a (very ugly) amateur plugin, that displays a list with the most likes:
I rewrote the plugin so much, that it fits the style of the top posters/top thread starters, but as you see, it still takes away lots of space. If possible, I would like to display the most likes list on the sidebox, and not on the main container part of the index. Is that possible?
If yes, please help me to establish that. I add the top likes list simply by adding {$topthanks} to the index template. I tried to do that to a custom side box, but it didnt work.
Here is the code of the toplikes plugin:
Has this to do with hooks? I never did anything with hooks, so I dont really have an idea of what to do.
Thank you
I am using the thankyou/like plugin, and I found a (very ugly) amateur plugin, that displays a list with the most likes:
I rewrote the plugin so much, that it fits the style of the top posters/top thread starters, but as you see, it still takes away lots of space. If possible, I would like to display the most likes list on the sidebox, and not on the main container part of the index. Is that possible?
If yes, please help me to establish that. I add the top likes list simply by adding {$topthanks} to the index template. I tried to do that to a custom side box, but it didnt work.
Here is the code of the toplikes plugin:
<?php
/*
*Srututu
*Plugin dla http://www.insidery.eu/
*Wykonany przez Matslom'a
*/
if(!defined('IN_MYBB'))
die('This file cannot be accessed directly.');
$plugins->add_hook("index_end", "topthanks_show");
function topthanks_info()
{
return array(
"name" => "Top thanks",
"description" => "Plugin do panelu bocznego wyświetlający najwięcej podziękowań z pluginu Thank You/Like System.",
"website" => "http://www.mybboard.pl",
"author" => "Matslom",
"authorsite" => "http://www.mybboard.pl",
"version" => "1.0.0",
"guid" => "*",
"compatibility" => "16*"
);
}
function topthanks_install()
{
}
function topthanks_uninstall()
{
}
function topthanks_activate()
{
}
function topthanks_deactivate()
{
}
function topthanks_show()
{
global $db, $mybb, $page, $topthanks, $theme, $permissioncache;
$topthanks .= '<table border="0" cellspacing="' . $theme['borderwidth'] . '" cellpadding="' . $theme['tablespace'] . '" class="tborder">
<tbody>
<tr>
<td class="thead" colspan="4" align="center">
<strong>Most Likes</strong>
</td>
</tr>
<tr>
<td class="trow1">
<table border="0" cellspacing"0" cellpadding="0" width=100%">
<tbody>';
$query = $db->query("
SELECT
u.tyl_unumrcvtyls, u.username, u.usergroup, u.displaygroup, u.avatar, u.uid
FROM ".TABLE_PREFIX."users as u
ORDER BY u.tyl_unumrcvtyls DESC LIMIT 10");
//Wyświetlanie danych
while($threadRow = $db->fetch_array($query))
{
if($threadRow['avatar'] == null)
{ $threadRow['avatar'] = './images/default_avatar.gif'; }
$awatar = "<a href=\"".$mybb->settings['bburl']."/".get_profile_link($threadRow['uid'])."\"><img src=\"".$threadRow['avatar']."\" width=\"24px\" height=\"24px\" alt=\"avatar\" class=\"favimg\" /></a>";
$usernameFormatted = format_name($threadRow['username'], $threadRow['usergroup'], $threadRow['displaygroup']);
$username = '<a href="member.php?action=profile&uid='.intval($threadRow['uid']).'"> '.$usernameFormatted.'</a>';
$thanks = '<a href="'.$mybb->settings['bburl']. '/tylsearch.php?action=usertylforthreads&uid='.$threadRow['uid'].'">'. $threadRow['tyl_unumrcvtyls'] .'</a>';
$topthanks .= '<tr>';
$topthanks .= '<td width="30px">'.$awatar.'</td><td align="left">'.$username.'</td><td align="right">'.$thanks.'</td>
</tr>
';
}
$topthanks .= "</tr></tbody></table></td></tr></tbody></table><br />";
}
?>
Has this to do with hooks? I never did anything with hooks, so I dont really have an idea of what to do.
Thank you