Topic: Mini Portal and top posters
Well, I want to add the top posters to the sidebar in Connorhd's miniportal. I've even searched these forums a few times, but I'm still clueless on how to do it.
Any pointers?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Mini Portal and top posters
Well, I want to add the top posters to the sidebar in Connorhd's miniportal. I've even searched these forums a few times, but I'm still clueless on how to do it.
Any pointers?
k...
I've added this to the bottom of the functions.php:
function top_posters()
{
global $pun_config, $lang_common, $pun_user, $db;
$result = $db->query('SELECT id, username, num_posts FROM '.$db->prefix.'users ORDER BY num_posts DESC LIMIT 10') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "<ul><li>\t\t\t\t\t\t".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> ('.$data['num_posts'].') '."\n</li></ul>";
}
}
And the following to header.php:
// START SUBST - <pun_top_posters>
$tpl_main = str_replace('<pun_top_posters>', '<div class="inbox">'."\n\t\t\t". top_posters()."\n\t\t".'</div>', $tpl_main);
//END SUBST - <pun_top_posters>
With the appropriate editing of the main.tpl. However, because the function is called in the header, it is being printed there, not in the right spot.
I've looked into changing the function to return instead of echo. However, it will only return one line of the top posters function..
Any clue on how to make this an array that will be printed in the appropriate place on the page?
Anyone with any help?
Or perhaps another suggestion on how to accomplish this?
Much appreciated!
Try putting it on footer.php and just replace echo by return and it should work.
But, I want it to follow the rest of the miniportal, so that I can include it in the main.tpl, and move it around, and use themes to change it's looks..
Nothing?
http://www.punres.org/files.php?pid=78
this is a mini protal that someone modified
i use it on http://nalan.org
it has the top posters and a few good mods in it
Q
I've finally figured it out, and have updated the miniportal wiki over at punres to include this tidbit.
Thanks for the help
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Mini Portal and top posters
Powered by PunBB, supported by Informer Technologies, Inc.