Log in

View Full Version : Link post number in postbit (Admin only)


Jawelin
02-25-2002, 02:59 PM
Hi. Weeks ago I modified my postbit template (actually it wasn't a hack) to make the post counter link to search.php?action=finduser, just as done here....
But found an unacceptable increment of MySQL (and CPU) load.. I.e. most users started submitting searches.... :surprised
So I had to remove that link.

Now I would try again showing that link only to Admins.
As said elsewhere, I'm not too good at template bits encapsulation, so would simply a tip how to start.
Could someone give the trick ?

Thanks

Admin
02-25-2002, 03:35 PM
In the getpostbit() function (functions.php), add a check like this:
if ($bbuserinfo['usergroupid']==6) {
// set $postcount to a link with HTML
} else {
// set $postcount to a static number
}

Jawelin
02-26-2002, 04:14 PM
Yeah!
Thanks to your tip I quickly made this stupid hack:

In functions.php, just before

$post[joindate]=vbdate($registereddateformat,$post[joindate]);

I added:
//HACK: linkable user posts for admins & supermods
if (($bbuserinfo['usergroupid']==6) || ($bbuserinfo['usergroupid']==5)) {
$postslink="<a href=\"search.php?s=$session[sessionhash]&action=finduser&userid=$post[userid]\">$post[posts]</a>";
} else {
$postslink="$post[posts]";
}
//HACK: linkable user posts for admins & supermods
Of course, in In postbit template
I replaced Posts: $post[posts] with Posts: $postslink...
If that could be useful to somebody...

Thanks again.
Bye