PDA

View Full Version : Percentage of posts in forum


Joshua Clinard
04-20-2002, 08:42 PM
Can someone create a hack that tells the pershentage of posts in each forum? We have a new ranking system, and we need to know the perchentage of a users posts in each forum. I want this to be displayed underneath thier post count if possible.

XAM
04-23-2002, 07:23 AM
Statistics of messages of the user on forums.

member.php

To find "// get last post" and insert before it(her)

// get users statistic
$r_userstats=$DB_site->query("SELECT forum.title,count(*)
FROM post,thread,forum
WHERE post.userid= '$userinfo[userid]'
AND post.threadid=thread.threadid
AND thread.forumid=forum.forumid
AND forum.countposts=1
GROUP BY forum.forumid
ORDER BY 2 DESC");
while ($r_userstat=$DB_site->fetch_array($r_userstats)) {
if ($backcolor=="#EEEEEE") {
$backcolor="#DEDEDF";
$bgclass = "alt2";
} else {
$backcolor="#EEEEEE";
$bgclass = "alt1";
}

$r_userstat_p = sprintf("%.2f",($r_userstat[1] * 100 / $userinfo[posts]));

$rt_userstats[title]="$r_userstat[0]";
$rt_userstats[value]="$r_userstat[1]";
$rt_userstats[pers]= "($r_userstat_p %)";
eval("\$rt_userstat .= \"".gettemplate("getinfo_userstats")."\";");

}


To create new Template getinfo_userstats:
<tr>
<td bgcolor="$backcolor"><normalfont>$rt_userstats[title]</normalfont></td>
<td align="center" bgcolor="$backcolor"><normalfont><b>$rt_userstats[value]</b></normalfont></td>
<td bgcolor="$backcolor"><normalfont>$rt_userstats[pers]</normalfont></td>
</tr>

In Template getinfo find "<normalfont>$userinfo[posts] ($postsperday posts per day)</normalfont></td></tr>"

To insert after it(her):
<tr>
<td bgcolor="#DEDEDF"> <normalfont> <b>Statistics of messages of the user on forums:</b></normalfont> </td>
<td>
<table cellpadding="4" cellspacing="1" border="0" bgcolor="#000000" width="100%">
$rt_userstat
</table>
</td>
</tr>


???? ?? ?????? ????? ?? ????????. :(