PDA

View Full Version : Forum statisctics at the top of each forum


grog6
04-26-2003, 10:00 PM
Ce hack affiche en haut de vos forums un petit tableau vous permettant de savoir quelques petites infos sur le forum dans lequel vous vous trouvez tels que :
- Nbe de sujets
- Nbe de reponses
- Meilleur posteur du forum
- Dernier posteur
- Note moyenne
- Vues totales des sujets du forum

Fichiers a modifier : 1
Templates a modifier : 1

Temps d'installation : 2 min


:banana:


This hack displays at the top of each forum, a table where many statistics are displayed such as :
- Number of threads created
- Number of relplys
- Best post creator
- last poster
- Average mark
- Total of sees of the forum

Files to modify : 1
Templates to modify : 1

installation time : 2 min





Voici la version anglaise


HERE IS THE ENGLISH VERSION

grog6
04-27-2003, 11:52 AM
VOICI LA VERSION FRANCAISE
Voici la version francaise

grog6
04-27-2003, 11:54 AM
Screenshot in English :cool:

grog6
04-27-2003, 11:55 AM
Capture en francais

iggy123
04-27-2003, 12:11 PM
Nice hack, will try it out later thnx

Dean C
04-27-2003, 12:34 PM
Very good idea ;)

In english we would say "Total Views" not "Total see's" :)

Regards

- miSt

MindTrix
04-27-2003, 01:04 PM
Wow thats brilliant!! Thanks **whacks install**

grog6
04-27-2003, 01:12 PM
@ Mist : Oupsss ;)

just correct it in the template ;)

Xenon
04-27-2003, 01:18 PM
looks really nice :)

hayl
04-27-2003, 02:17 PM
install

wolfe
04-27-2003, 07:32 PM
i have made a revamp and i have redone the template and made it a seperate template check it out.

wolfe
04-27-2003, 07:35 PM
SCREEN:

Disturbed
04-27-2003, 08:29 PM
wats the difference between both hacks?

eh nevermind, figured it out :P

nice hack grog, thanks for sharing

wolfe
04-27-2003, 08:31 PM
well there both the same hack made by grog6 but i have cleaned up the template and bit and made it so it has its own template for the stats. :D much easier to edit because no matter what you add to the forumdisplay_stats templateyou know its only for this hack. you can't go wrong

Boofo
04-27-2003, 09:02 PM
Today at 04:31 PM wolfe said this in Post #14 (https://vborg.vbsupport.ru/showthread.php?postid=388127#post388127)
well there both the same hack made by grog6 but i have cleaned up the template and bit and made it so it has its own template for the stats. :D much easier to edit because no matter what you add to the forumdisplay_stats templateyou know its only for this hack. you can't go wrong

You forgot to tell them to put $forumdisplaystats in the forumdisplay template and also to add forumdisplay_stats to the templatesused line in the forumdisplay.php (to save an extra query).

How do you link the last poster so it will bring up their profile when you click on it?

Logik
04-27-2003, 09:19 PM
nice hack. thanks.

Boofo
04-27-2003, 09:53 PM
I'm getting this to show up on a few forums:

Number Of Threads In This Forum: 2 Number Of Replys: 5
Top Poster In This Forum: (0%) Last Poster In This Forum: Boofo
Average Rating In This Forum: Total Views of threads in this forum: 117

It doesn't name the top poster on some forums. Any ideas what could be causing this?

subu1
04-27-2003, 10:28 PM
fine Hack *click install* but can you change % with a Number???

greetz subu1

Snapperhaed
04-28-2003, 04:06 AM
Installed with little effort, thanks!

One problem I do have, is that the english version is shown at the bottom of the page, and not the top in v2.3 #3. Maybe I just inserted somewhere incorrectly? Could Be!?! :D ... Smacks install.

grog6
04-28-2003, 04:20 AM
@Boofo : I've the same problem in some forums too :-/
I'll look for it during the evening and try to correct it

@Snapperhaed : I don't understand ;) (I'm a small frenhcy ... :D)

@Subu1 : replace $avgposteur by $avgposteuri in the template modification ;)

Boofo
04-28-2003, 05:44 AM
Today at 12:06 AM Snapperhaed said this in Post #19 (https://vborg.vbsupport.ru/showthread.php?postid=388271#post388271)
Installed with little effort, thanks!

One problem I do have, is that the english version is shown at the bottom of the page, and not the top in v2.3 #3. Maybe I just inserted somewhere incorrectly? Could Be!?! :D ... Smacks install.

Just put the code above $forumdisplay[threadslist].

Boofo
04-28-2003, 05:47 AM
Today at 12:20 AM grog6 said this in Post #20 (https://vborg.vbsupport.ru/showthread.php?postid=388279#post388279)
@Boofo : I've the same problem in some forums too :-/
I'll look for it during the evening and try to correct it



Thank you, sir. ;)

Also, can you make the lastposter a link to the user's profile (like the Best poster is)?

And you might want to include the posts that are threads in the best poster. I have a forum where I have posted mostly threads and someone else is picked as the top poster when they have only posted 3 or 4 times. The Best poster count is way off for some of my forums, too. ;)

grog6
04-28-2003, 07:02 AM
@Boofo : No pb for the link ;) But I think a query will have to be modified for it ;)

I'll modify it to count user's thread too ;) and look for the reason of non-working in some forums

Boofo
04-28-2003, 08:59 AM
Today at 03:02 AM grog6 said this in Post #23 (https://vborg.vbsupport.ru/showthread.php?postid=388316#post388316)
@Boofo : No pb for the link ;) But I think a query will have to be modified for it ;)

I'll modify it to count user's thread too ;) and look for the reason of non-working in some forums

Thank you, again, sir. I'll be looking forward to the fixes. ;)

I did notice that in some forums, it does count the thread posts and in others it doesn't.

wolfe
04-28-2003, 11:47 AM
Yesterday at 11:02 PM Boofo said this in Post #15 (https://vborg.vbsupport.ru/showthread.php?postid=388149#post388149)
You forgot to tell them to put $forumdisplaystats in the forumdisplay template and also to add forumdisplay_stats to the templatesused line in the forumdisplay.php (to save an extra query).


soz d00d i forgot to do that on my site lol thanx for the info d00d

wolfe
04-28-2003, 11:52 AM
Today at 06:06 AM Snapperhaed said this in Post #19 (https://vborg.vbsupport.ru/showthread.php?postid=388271#post388271)
Installed with little effort, thanks!

One problem I do have, is that the english version is shown at the bottom of the page, and not the top in v2.3 #3. Maybe I just inserted somewhere incorrectly? Could Be!?! :D ... Smacks install.



d00d if you used my edited version then in the forumdisplay template

above

$forumdisplay[threadlist]

add


<br>
<center>
<table cellpadding="0" cellspacing="0" border="0" bgcolor="{ tablebordercolor}" width="50%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr id="cat">
<td bgcolor="{ tableheadbgcolor}" align="center" nowrap colspan="3"><normalfont><b>Statistics Of Forum: <i>$foruminfo[title]</i></b></normalfont></td>
</tr>
<tr>
<td bgcolor="{ firstaltcolor}" align="center" colspan="3" nowrap>
<table cellpadding="4" cellspacing="0" border="0" width="100%">
<tr>
<td nowrap><smallfont><b>Number Of Threads In This Forum:</b> $nbemess</smallfont></td>
<td nowrap><smallfont><b>Number Of Replys:</b> $nbepost</smallfont></td>
</tr>
<tr>
<td nowrap><smallfont><b>Best Poster In This Forum:</b> <A HREF="member.php?s=$session[sessionhash]&action=getinfo&userid=$liste[postuserid]" target="_blank">$mposteur</a> (<b>$avgposteur%</b>)</td>
<td nowrap><smallfont><b>Last Poster In This Forum:</b> $dposteur</smallfont></td>
</tr>
<tr>
<td nowrap><smallfont><b>Average Rating In This Forum:</b> $moyenne</smallfont></td>
<td nowrap><smallfont><b>Total Views of threads in this forum:</b> $vue</smallfont></td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>


for the original or add

$forumdisplaystats above it.


remember in the code above delete the spaces after the {'s

subu1
04-28-2003, 11:57 AM
@grog6 , thnky you,

but i have a question. The best Poster ist not correkt in a forum.

The best Poster in a Forum ist not display there, but another Poster ???

What can i do, please help, thank you;)

Boofo
04-28-2003, 12:32 PM
grog6, found another problem. I have a forum that it says has an average threads rating of 4 stars and there have been no ratings at all in that forum. ;)

subu1
04-28-2003, 12:43 PM
sorry but i have found another bug, i thing so. I have a lot of subforums but it is not shows on display.

its my german board, sorry for my eng. :surprised:

look my att.

flup
04-28-2003, 02:32 PM
Really nice done! wont install though

grog6
04-28-2003, 03:07 PM
@ subu1 : I'll make modifications to show 0 if there is no post or don't show it at all if you prefer ;)

@ Boofo : Are you sure there is no rate at all ? even in the DB ? because in the forumdisplay, the rate is only shown if there is more than 1 vote in the same post I think ;)

Boofo
04-28-2003, 03:11 PM
Today at 11:07 AM grog6 said this in Post #31 (https://vborg.vbsupport.ru/showthread.php?postid=388447#post388447)

@ Boofo : Are you sure there is no rate at all ? even in the DB ? because in the forumdisplay, the rate is only shown if there is more than 1 vote in the same post I think ;)

I double checked it. There are no rating votes in that forum. ;)

subu1
04-28-2003, 04:38 PM
ups, i am verry stupid , sorryyyyyyyy.:-))

but why this here, Takeda is not the Best Poster, it is Keek :confused:

grog6
04-28-2003, 06:20 PM
@ subu1 : not stupid at all, I try correct it now, but it's really strange, I've some forums where all seems (and is) to be OK, and in an other, I've exactly the same thing as you, my code is correct, queries too ... :ogre:

I'll find, I'll find, I'll find a solutionnnnnnnnn :bunny:

wolfe
04-28-2003, 10:41 PM
lol hope you do d00d its a great hack :D

Jadelit
04-29-2003, 05:21 AM
could you please update the attachment.

Thanks

irn-bru
04-29-2003, 07:14 AM
Is this able to go in to the subforums like forumdisplay forumbit level1_post ect.

sabret00the
04-29-2003, 01:17 PM
'best poster' seems to give out the wrong information is there anyway to fix this at all?

grog6
04-29-2003, 01:41 PM
@ sabret00the : I've created a post yesterday in the PHP/MYSQL section here, have no answer for the moment, I've looked for this problem yesterday evening during more than 1 hour, don't have find where the problem is :-/

The stranger thing is that it displays the correct username in some forums , but in some others, it doesn't show the reality :5 I don't desesperate to find a solution for this problem ...

amykhar
04-29-2003, 02:04 PM
Bug fix for the incorrect Best Poster:

Find:

$j=1;
while ($j<$i) {
if ($counts[$j]>$counts[$j-1]) {
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}


Replace With:


$j=1;
$max = 0;
while ($j<$i) {
if ($counts[$j]>$max) {
$max = $counts[$j];
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}


The original code put all the posters in an array. Then, it said if poster x had more posts than poster x-1, it was the best poster. This was wrong. A max value had to be set and held. So, The max started out at 0. If poster x had more posts than max, poster x became the best poster and max became the number of posts X had made. It seems to work fine on my forums.

Amy

amykhar
04-29-2003, 02:46 PM
The other issue is that it's not truly "Best Poster". It is, more accurately, "Most Threads Started by: " The name extracted is the person who started the most threads in the forum and the percentage is the number started by the user divided by the number of threads in the forum.

Amy

grog6
04-29-2003, 02:56 PM
BIG Thx for it amykhar :) :) :)

I'll update the archive now ;)

amykhar
04-29-2003, 03:13 PM
With my $max fix in, you can also save a query:


Find:



$avgposteurs=$DB_site->query_first("SELECT COUNT(postusername) AS moyenne FROM thread WHERE (forumid='$forumid' AND postusername='$mposteur')");
$avgposteuri=number_format($avgposteurs['moyenne']);



Replace with:



$avgposteuri=$max+1;

grog6
04-29-2003, 03:43 PM
So, I've updated the 2 archives

Modifications :
- Better translation in the english version ( Eheh Mist ;) )
- The hack is now included in a new template (thx to wolfe for it :) )
- Bug of the best thread's creator is now corrected, thx to amykhar for it and his query imrovment :bunny:

sabret00the
04-29-2003, 03:58 PM
so if that shows the 'top thread starter' how would i go about lets say replacing the 'average rating in this forum' with 'top poster in this forum'? sorry to be a pain

amykhar
04-29-2003, 04:29 PM
Today at 12:58 PM sabret00the said this in Post #45 (https://vborg.vbsupport.ru/showthread.php?postid=388910#post388910)
so if that shows the 'top thread starter' how would i go about lets say replacing the 'average rating in this forum' with 'top poster in this forum'? sorry to be a pain

I looked at pulling the top poster rather than the top thread starter, but the query and algorithm was daunting. It would be a real server killer. At this point, I can't think of a good way to do that without bringing a server to its knees.

Amy

Zelda-King
04-29-2003, 04:30 PM
Regarding the English version;

- The plural for 'reply' is 'replies', not 'replys'.

- There should be no gap if you put ':' after a word. For example, 'Statistics of the forum : Main Forum' should be 'Statistics of the forum: Main Forum'.

Another note, your hack is entitled 'Forum statisctics at the top of each forum' but by your coding it is shown at the bottom. I actually prefer it at the bottom anyway. :)

No big deal. Your English is wayyyyyyy better than my French!

grog6
04-29-2003, 04:36 PM
@ amykhar : I agree with you, that's why I selected Best threads creator ;). In the VBulletin's database, forumid is not shown in the post's table, and seen the number of posts per forum, it would be really hard for the server :-/


@ Zelda-King : Shown at the bottom ? :eek: Probably have replace a above by under in my translation ;), will correct it now but this hacks should be display at the top of each forum as said in my tread title ;)
I know my english is not perfect, I try to do my best and I think I'm quite understanble ;)

lordofgun
04-29-2003, 09:07 PM
Will this work in 2.2.6?

grog6
04-29-2003, 09:11 PM
Yes lordofgun

I think ;) If it doesn't work, report bugs here, but I'm sure at 99% it will work

amykhar
04-29-2003, 09:38 PM
Regarding the thread rating problem, I am not sure about this, but you might want to take the average of the totalvote column in the thread table instead. This value appears to be the average rating for each thread and taking an average of that column would be a more accurate representation of what you want.

Amy

amykhar
04-30-2003, 12:10 AM
There's another bug. In forums with large numbers of threads, the average is coming out wrong. I am finding averages of 26600 % in one forum.

The fix is to change:


$nbemess=number_format($nbemesss['nbe']);


to


$nbemess=$nbemesss['nbe'];


If you want the comma displayed in the forumdisplay, just create a new variable such as $numthreads = number_format($nbemess); and put $numthreads in the template instead of $nbemess.



Amy

Boofo
04-30-2003, 12:38 AM
It seems the last poster is still not coming up quite right. I think it must be going by server time because in 1 forum I have a lastposter at 3:58 pm today and it still shows the one from yesterday. Any way to put it from the forum itself?

subu1
04-30-2003, 05:50 AM
Yesterday at 04:04 PM amykhar said this in Post #40 (https://vborg.vbsupport.ru/showthread.php?postid=388881#post388881)
Bug fix for the incorrect Best Poster:

Find:

$j=1;
while ($j<$i) {
if ($counts[$j]>$counts[$j-1]) {
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}


Replace With:


$j=1;
$max = 0;
while ($j<$i) {
if ($counts[$j]>$max) {
$max = $counts[$j];
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}


The original code put all the posters in an array. Then, it said if poster x had more posts than poster x-1, it was the best poster. This was wrong. A max value had to be set and held. So, The max started out at 0. If poster x had more posts than max, poster x became the best poster and max became the number of posts X had made. It seems to work fine on my forums.

Amy

thxx it works, on 2.2.8 :bunny:

subu1
04-30-2003, 08:09 AM
ok, I has however still another question of a Member with us in the forum. One can adjust it in such a way that the box is not indicated if no topics is there. That is the case if one into the overview forums goes and there only Subforen.

i hope my eng. is ok :rolleyes:

Boofo
04-30-2003, 08:19 AM
If you have Xenon's "More Functions in Edit Post if you are an Admin" hack installed and you edit the time on a message, it will not pick it up as the Last Poster. It will pick the one before it. Also, I am still get the Average rating to show start for some forums that there has been no rating in at all. The Top thread starter seems to work now but it does not include announcement threads. Any way to pick that up?

Boofo
04-30-2003, 08:22 AM
Yesterday at 12:36 PM grog6 said this in Post #48 (https://vborg.vbsupport.ru/showthread.php?postid=388934#post388934)
@ amykhar : I agree with you, that's why I selected Best threads creator ;). In the VBulletin's database, forumid is not shown in the post's table, and seen the number of posts per forum, it would be really hard for the server :-/


You should be able to do a LEFT JOIN on the query for the last poster and pull the forumid, shouldn't you? ;)

Holidazed
04-30-2003, 07:21 PM
hmm, maybe a BUG. When I view a sub-forum that has a total of six threads (each started by a different person, this hack displays "Most Threads Started by: (17 %)". In other words, no name at all is displayed, but % is there anyway. Granted, the % is correct, but should not say "6-way tie) or something like that?

Holidazed
04-30-2003, 07:22 PM
boofo still has not had a question answered and I need the answer too. How do we link the "Last Poster" to the profile like the "Most Threads Started by" is?

grog6
04-30-2003, 09:17 PM
@ Boofo : You can use this query to get back the userid of the lastposter in a specific forum with this query :

SELECT lastposter, userid FROM thread,user WHERE (thread.forumid='$forumid' AND user.username=thread.lastposter) ORDER BY threadid DESC LIMIT 0,1

@ bitg : For your first post (bug), it's strang, all works now perfectly for me with amy's modification

Concerning your second question, I've answered here ;) and modify it now to add a link to the lastposter's profile

grog6
04-30-2003, 09:26 PM
So, to add link to lastposter'sprofile, replace in admin/functions.php :

$dposteurs=$DB_site->query_first("SELECT lastposter FROM thread WHERE forumid='$forumid' ORDER BY threadid DESC");
$dposteur=$dposteurs['lastposter'];

with

$dposteurs=$DB_site->query_first("SELECT lastposter, userid FROM thread,user WHERE (thread.forumid='$forumid' AND

user.username=thread.lastposter) ORDER BY threadid DESC LIMIT 0,1");
$dposteurnom=$dposteurs['lastposter'];
$dposteurid=$dposteurs['userid'];

and in the template forumdisplay_stats, replace $dposteur with

<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$dposteurid"
target=_blank>$dposteurnom</a>

:)

subu1
04-30-2003, 10:38 PM
i cant find this in admin/functions.php :(

grog6
04-30-2003, 11:29 PM
Haven't you it at the end of the modification there is to do for my hack :

$dposteurs=$DB_site->query_first("SELECT lastposter FROM thread WHERE forumid='$forumid' ORDER BY threadid DESC");
$dposteur=$dposteurs['lastposter'];
eval("\$forumdisplaystats = \"".gettemplate('forumdisplay_stats')."\";");

??

Boofo
04-30-2003, 11:58 PM
Today at 06:38 PM subu1 said this in Post #62 (https://vborg.vbsupport.ru/showthread.php?postid=389689#post389689)
i cant find this in admin/functions.php :(

grog6 meant to say the forumdisplay.php file, not functions.php. ;)

Boofo
05-01-2003, 12:04 AM
grog6, the lastposter link code works like a charm. Thanks. ;)

bitg is right about the Top Thread Starter bug. If you have a forum with only one thread in it, it will also give the error where it will show 100 % but no Top Thread Starter username. If you also have a forum where every thread is started by a different user, it will not show the username, because it doesn't know which one to pick. You must have threads started by the same username for it to show the name. I hope that makes sense. ;)

Amy, is there a way to fix the Average rating like you posted? It is still showing in one of my forums as a thread rating of 4 stars for an average and there are no thread ratings whatsoever in that forum.

grog6
05-01-2003, 09:41 AM
@ Boofo : strange for the vote :-/

Run this query on your DB, just replace the $forumid with your forumid, and say us which result, you have

SELECT AVG(vote) AS moythread FROM thread,threadrate WHERE (thread.forumid='$forumid' AND
threadrate.threadid=thread.threadid

It may show you sthg between 3.5 and 4.5, if it is not, there really might be a problem, but take a look at it before ;)

Boofo
05-01-2003, 11:20 AM
I ran this query because the one you gave me gave a db error.

SELECT AVG(vote) AS moythread FROM thread,threadrate WHERE thread.forumid='13' AND threadrate.threadid=thread.threadid;

and here is what it returned:

vote)ASmoythread

Holidazed
05-01-2003, 06:11 PM
grog, thanks for the update. The Last Poster link works awesome. Now for the bug that shows no user name when more than one user has the same amount of posts.

Edgar
05-04-2003, 04:57 PM
Sweet hack, works perfect on my forum.
I do have a few questions though. Will there be a similar hack in the future to display the same stats but then for all forums together on the forums home page?

I hope you know what I mean.

RetroDreams
05-04-2003, 11:38 PM
Is there a reason that the total views doesn't use the proper comma format like the total threads and replys?

grog6
05-04-2003, 11:42 PM
@ RetroDreams : what's the problem exactly ?

RetroDreams
05-05-2003, 12:14 AM
Today at 01:42 AM grog6 said this in Post #71 (https://vborg.vbsupport.ru/showthread.php?postid=391548#post391548)
@ RetroDreams : what's the problem exactly ?

Well, total threads and replys have commas in the numbers after they hit 1,000, but the total views does not, so it would read 1000, instead of 1,000 - Just looking for parity.

Boofo
05-05-2003, 12:47 AM
Just replace:

$vue=$vues['vu'];

with this:

$vue=number_format($vues['vu']);

Did anyone ever get the Average rating thing figured out?

Sweet Evil
05-05-2003, 11:54 PM
I would like it to link to last posters profile and also I do not wish for the rating and would like to show and link to newest member.
I added the code for newest member from forumhome template but it is not showing the newest member nor a link.

My Display (http://www.yourhostsucks.com/forums/forumdisplay.php?forumid=48)

Anyone make these changes and can let me in as to how? :)

Thanks!

subu1
05-06-2003, 05:16 AM
Yesterday at 02:47 AM Boofo said this in Post #73 (https://vborg.vbsupport.ru/showthread.php?postid=391566#post391566)
Just replace:

$vue=$vues['vu'];

with this:

$vue=number_format($vues['vu']);

Did anyone ever get the Average rating thing figured out?

thxx i do it, it works, and what is with "total clicks"

greetz and thxx subu1

Boofo
05-06-2003, 05:28 AM
Total clicks? I don't understand. Where did you see that at?

subu1
05-06-2003, 05:47 AM
Today at 07:28 AM Boofo said this in Post #76 (https://vborg.vbsupport.ru/showthread.php?postid=392082#post392082)
Total clicks? I don't understand. Where did you see that at?

ups it is so in german, I meant total views

thxx Boofo ;)

Boofo
05-06-2003, 06:00 AM
That is the toal threads views for the forum.

subu1
05-06-2003, 06:06 AM
yes, and there is a comma too

Boofo
05-06-2003, 06:12 AM
Isn't that what you wanted? ;)

subu1
05-06-2003, 06:30 AM
isnt??? what you mean......yes;)

theologyonline
05-07-2003, 11:30 PM
I am not sure I understand the "last poster" thing.

My "last poster" rarely seems to be correct.

I read this entire thread and I am not sure if this has been answered specifically or not.

Crazy Pete
05-09-2003, 10:48 PM
I have the same problem with the last poster thing. Sometimes it's right, other times it's not. Not sure what to do with it at this point.

Boofo
05-10-2003, 01:33 PM
grog6, are you still supporting this hack. There are a few of us that are having problems with the lastposter not being right in a few forums. Any solution for this?

squawell
05-11-2003, 04:10 AM
grog6 how to do top x stats of each forum??

do u have any idea? :bunny:

grog6
05-11-2003, 10:31 AM
@ Boofo : Yup, I still support this hack, but I had problems such as a lot of other members to access vbulletin.org, it's now 3 days I couldn't access to this site ;)


For the last poster, You're right, a query seems to not be 100% correct ... I'll take a look at it during the evening and will try to fix this bug ;)

grog6
05-11-2003, 10:32 AM
@ squawell : Don't understand what you want to do .. ;)

Boofo
05-11-2003, 10:39 AM
Today at 06:31 AM grog6 said this in Post #86 (https://vborg.vbsupport.ru/showthread.php?postid=393629#post393629)
@ Boofo : Yup, I still support this hack, but I had problems such as a lot of other members to access vbulletin.org, it's now 3 days I couldn't access to this site ;)


For the last poster, You're right, a query seems to not be 100% correct ... I'll take a look at it during the evening and will try to fix this bug ;)

Can you also take a look at the Average Rating query, too? I am still getting 4 stars on a forum that has no thread ratings at all. ;)

grog6
05-11-2003, 10:49 AM
@ Boofo : I'll take a loot at it too for you ;) But it seems to me this query is OK

squawell
05-11-2003, 11:47 AM
Today at 07:32 PM grog6 said this in Post #87 (https://vborg.vbsupport.ru/showthread.php?postid=393631#post393631)
@ squawell : Don't understand what you want to do .. ;)
see attach pic...something like that...any idea? :)

cirisme
05-11-2003, 12:27 PM
Installed and running well on 2.2.9! :D

Haven't had any prolems with the average rating, or last poster, but I have been making a few modifications. ;)

Boofo
05-11-2003, 12:44 PM
Check the last poster in your Frat House forum. ;)

Boofo
05-11-2003, 12:47 PM
Also, check your average rating in the Dean's List. ;)

yxboom
05-11-2003, 03:02 PM
Mononoke is a bot but Im sure you already noticed that and I saw the Dean's List rating that is hilarious. This is one of those times where we say......ooops. ;)

Thanks Boofo! :)

Boofo
05-11-2003, 03:06 PM
Still the last poster should have been updated right if the query was working ok. ;)

It's nice to see that I am not the only one having the Average Rating problem. ;)

cirisme
05-11-2003, 04:23 PM
The Bot doesn't update the forum info, so I'm not all that suprised.(although, now that you bring it up; I think I'll update that :D)

As for the average rating... oops. :D

Boofo
05-11-2003, 04:24 PM
Which Bot are you using?

Boofo
05-11-2003, 05:12 PM
Ok, here is the fix for the lastposter problem. Thanks goes out to Logician for providing the basis of this code in one of his hacks. ;)

In forumdisplay.php, change the last poster query to:

$dposteurs=$DB_site->query_first("SELECT post.dateline, thread.threadid, username, userid FROM post,thread WHERE thread.forumid=$forumid AND thread.threadid=post.threadid ORDER BY post.dateline DESC LIMIT 1");

and use this for the lastposter code in the template:

<td nowrap><smallfont><b>Last Poster:</b> <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$dposteurs[userid]" target=_blank>$dposteurs[username]</a></smallfont></td>

Let me know if this fixes it for everybody. It did for me. ;)

cirisme
05-11-2003, 05:13 PM
It's the TomBot. There is a way to make it appear as the last poster, but it got overwritten(IIRC think it was by another hack) it and I have been too lazy to put it back. :)

BTW, the query that runs the average rating is:

SELECT AVG(vote) AS moythread FROM thread,threadrate WHERE (thread.forumid='$forumid' AND
threadrate.threadid=thread.threadid)

....and I ran it manually in PHPMyAdmin, and the average rating is 4.5. Weird eh? I'm looking for a fix for this so I can pry my foot out of my mouth. ;)

Boofo
05-11-2003, 05:15 PM
I'm working on that one now. I just posted the fix for the last poster above. Try it and let me know if it fixes it for you. ;)

cirisme
05-11-2003, 06:08 PM
Okay thanks.

FYI: There is nothing wrong with the average rating. Something must be wrong with in the vote section for each thread in forumdisplay, because there are several threads in the Dean's List that ARE rated 4~5.

It's pretty weird. :nervous:

Reverend
05-11-2003, 06:47 PM
Installed seems to working OK.

One question though.
Would it not be better for the Average Rating to use the formula;
(total stars divided by total threads in the forum),rather than only including threads that have been rated.

Just a thought. ;)

Boofo
05-11-2003, 07:17 PM
I think that would be better. How do we go about doing that?

Boofo
05-11-2003, 07:27 PM
Ok, I was told that the query I posted earlier for the last poster fix, might give false information at a point in the future. Here is the updated one. This one works, I've tested it.

$dposteurs=$DB_site->query_first("SELECT post.dateline, thread.threadid, user.username
FROM post, thread
LEFT JOIN user ON user.userid = post.userid
WHERE thread.forumid = $forumid AND thread.threadid = post.threadid
ORDER BY post.dateline DESC
LIMIT 1");

Just use $dposteurs[username] for the username. I'm not sure what tio use to pull the userid out of this query, though. Can someone lend a hand?

cirisme
05-11-2003, 07:43 PM
$dposteurs=$DB_site->query_first("SELECT post.dateline AS lastpostminute, thread.threadid, user.username, user.userid
FROM post, thread
LEFT JOIN user ON user.userid = post.userid
WHERE thread.forumid = $forumid AND thread.threadid = post.threadid
ORDER BY post.dateline DESC
LIMIT 1");

SHOULD do it(hopefully). And then use $dposteurs[userid]. But let me go test it. :D

Edit:

Okay, looks good. Thanks! :banana:

cirisme
05-11-2003, 08:17 PM
Umm, it is user.userid not post.userid.

:nervous:

Boofo
05-11-2003, 08:39 PM
You're right. I just got verification on the userid. The code is good at this:

$dposteurs=$DB_site->query_first("SELECT post.dateline, thread.threadid, user.username, user.userid
FROM post, thread
LEFT JOIN user ON user.userid = post.userid
WHERE thread.forumid = $forumid AND thread.threadid = post.threadid
ORDER BY post.dateline DESC
LIMIT 1
");

Now, all we have to do is get the Average rating to work right on my site. ;)

cirisme
05-12-2003, 01:55 PM
What forums is it not working on?

Boofo
05-12-2003, 02:01 PM
One of my Total Commander Forums.

grog6
05-12-2003, 02:54 PM
Sorry, I haven't a lot of time for the moment, sorry for not having helped you ...

Really big thanks to Boofo for the support
I'll add these modifications to the archive as soon as I could

Thx to Boofo and other members to fix this hack :)

Boofo
05-15-2003, 01:26 AM
grog6, any more fixes or updates for this hack?

Boofo
05-16-2003, 09:06 AM
Well, since no one else seems to be supporting this hack now, I have an update that will knock 2 queries off of the stats.

Find these 3 queries and delete them:

$nbeposts=$DB_site->query_first("SELECT SUM(replycount) AS reply FROM `thread` WHERE forumid=$forumid");
$nbepost=number_format($nbeposts['reply']);

$nbemesss=$DB_site->query_first("SELECT COUNT(*) AS nbe FROM thread WHERE forumid=$forumid");
$nbemess=$nbemesss['nbe'];
$numthreads = number_format($nbemess);

$vues=$DB_site->query_first("SELECT SUM(views) AS vu FROM thread WHERE forumid='$forumid'");
$vue=number_format($vues['vu']);

Use this single query instead:

$nbeposts=$DB_site->query_first("SELECT COUNT(*) AS nbe, SUM(replycount) AS reply, SUM(views) AS vu FROM `thread` WHERE forumid=$forumid");
$nbepost=number_format($nbeposts['reply']);
$numthreads = number_format($nbeposts['nbe']);
$vue=number_format($nbeposts['vu']);

You will also need to find:

$avgposteur=(($avgposteuri/$nbemess)*100);

and change it to:

$avgposteur=(($avgposteuri/$nbeposts['nbe'])*100);

for the average poster stat to work with the new query.

Crazy Pete
05-16-2003, 12:58 PM
Thanks for the update, Boofo! Any way to save a few queries, I'm all over it. :)

Boofo
05-16-2003, 04:52 PM
You're very welcome. ;)

grog6
05-16-2003, 09:26 PM
Sorry :(

I really have too work for the moment, and can't provide any support for this hack.

As soon as possible, I'll look, udpate the hack with your work Boofo, and try to help for support here.
Sorry but I can't now :(

Boofo
05-19-2003, 09:07 PM
Since Grog6 has not had time to support this hack, an updated (with his permission) and expanded version of this has been released in this thread:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=53138

CRego3D
05-20-2003, 02:20 AM
excellent .. :)