Modification Name: Statistics
Author(s): Brett
Description: This hack displays statistics for your UBB like a separate category at the bottom of forum home and provides a detailed stats page.
Demo: Click Here Requirements: UBB 6.6.x, 6.7.x
Download Link: For UBB 6.6.x ONLY:
https://www.ubbdev.com/ubb/upload/00006378/Statistics6.6.zip For UBB 6.7 Beta ONLY:
https://www.ubbdev.com/ubb/upload/00006378/Statistics6.7.zip Credits: Tovok7, LK, Gizzy, Wierd Al
Instructions / Other Info: Updates:
- ubb_statistics.cgi has been completely renovated. It takes advantage of 6.x's file structure, CI's, etc for less file usage. And a few other things, 'spiced' up. (now using strict, )
- CSS Template compatible
Besides that, nothing really new. Any ideas?
*goes off to test*
I hope you fixed the SSI part, I just noticed it wasn't working in my version
Thank you
quote:
Originally posted by Brett:
ubb_statistics.cgi has been completely renovated. It takes advantage of 6.x's file structure, CI's, etc for less file usage. And a few other things, 'spiced' up. (now using strict, )Jeese Brett lol... Can I not half ass things anymore :x...
everything works except the most recent topic. He used the active topics file, but those topics aren't store in order there
When I installed this before it was a real resource hog. Has anything been modified to change that?
Code suggestions...
&TotalsLastUser: %vars_forums is your friend.
&GetLatestPost: Please use the Get* routine from ubb_lib_files, as the active topics datafile may not be in a sane state. I built the routines for a reason, you know. Also, the keys function returns in the hash order, which is never right. Use a sort and drop the reverse, as it isn't working right as-is.
&GetMemberCount: Again, please use the proper Get* routine from ubb_lib_files...
&CreateChart: Please use &DirExists.
Thanks CC
Yea, i don't know what i was thinking when i didn't sort the active topics.
On the bright side, it's better than going into each meta file and looking at each date then opening the topic file.
I updated the zip, updating those mentioned by Charles. The only file changed is ubb_statistics.cgi.
RandyM: A definite Yes.
quote:
Originally posted by RandyM:
When I installed this before it was a real resource hog. Has anything been modified to change that?
Yeh well my perl scripting sucks ok
it's why I have Wierd Al and Brett on my coding team :x...
quote:
Originally posted by Gizzy:
quote:
[qb]Originally posted by RandyM:
When I installed this before it was a real resource hog. Has anything been modified to change that?[/qb]
Yeh well my perl scripting sucks ok
it's why I have Wierd Al and Brett on my coding team :x...
lol, he was talking about my version
Brett, I get javascript errors and "Last post by in at on "
I don't think that's right
Can someone else please test this? For some reason, Al, your active topics file isn't being loaded through the GetTodaysActiveTopics sub. When i loaded your active topics file, it loaded fine. I even did a mini port to 6.5 that i still have installed and it loads fine.
I dunno, maybe my sorting method is flawed... :
lol
I meant the versions going way back as well. I would love to be able to use this again. If it is less hoggish I'm going to give it a shot. Maybe CC can add more info about the resources used?
My guess is until someone turns it into a php solution, it will always be a resource hog. Just think about how many things it has to open. Every cache folder you ever had, all of those calculations that it requires. It's kinda like working without the cache if I understand correctly. Every time someone posts, it's called on the forum summary. Everytime someone views the statistics page, all of those folders are opened and closed, and calculations are made. Don't forget that this also happens anytime someone views a page that has the SSI version on it.
Brett, I don't know why my board is giving you so much trouble. First the universal headers, now this
quote:
Originally posted by Weird Al:
My guess is until someone turns it into a php solution, it will always be a resource hog.
What do you mean? Make a PHP Stat hack? Now THAT would be a feat in and out itself. Requiring files with hashes incompatible with php. Or are you saying turn UBB into PHP? Like PHP isn't capable of being a resource hog? *coughyabbsbcough*
sure, you pick the one sentence that makes no sense out of that very nice post I made
Alright, from what i got my response is that statistics page, forum page, profile page, it doesn't matter. Each time you view those pages(cached or not), files are opened, there's other way. It just depends on how many/much is opened. This hack opens about 1/4 of previous versions, resource hog less, no?
quote:
Originally posted by Weird Al:
any word on a fix?
I'm slow, which fix are we waiting for?
the one for the most recent post
ubb_statistics.cgi needs to reference vars_wordlets_mods{stuff} instead of vars_wordlets{stuff}.
I found something that may or may not be a problem but for me it caused the right column of stats on the summary page to have the wrong size font.
In ubb_statistics.cgi at line 440 you have this;<br><br><div class="ubbcode-block"><div class="ubbcode-header">Code</div><div class="ubbcode-body ubbcode-pre" ><pre><font size="1" face="$vars_style{FontFace}">$Misc[2]</font></pre></div></div>Then on line 670 you close the tags and the <td> to start the next column with this;<br><br><div class="ubbcode-block"><div class="ubbcode-header">Code</div><div class="ubbcode-body ubbcode-pre" ><pre> return qq~</font></td><td align="left" colspan="$statcolspan" width="50%" bgcolor="$vars_style{AltColumnColor1}" valign="top" class="darktable"><font color="$vars_style{TextColor}" face="$vars_style{FontFace}">~; </pre></div></div>Since the size wasn't specified at "1" again it reverted to the boards font size.
quote:
Originally posted by Weird Al:
the one for the most recent post
So far this is working fine for me. Sorry about spamming the posts but each one relates to something different. I didn't want to confuse anyone (especially me).
would you be able to PM me the contents of your activetopics file? noncgi/cache-********/search-index/activetopics.cgi
Just want to compare them
I reuploaded the file (I hadn't modified the old one) and for some reason it now works. :-/
Thanks Randy
You obviously fixed it by sending me the file
Haha, that's the way it works sometimes. This version of the stats hasn't slowed my board down at all.It seems to run really well.
quote:
Last post by Al in For Brett at on November 20, 2003 11:29 AM
Brett, anyway to get 11:29AM to be between at and on?
Hi,
I have the problem that I only get numbers, but all ist hacked correctly in vars_wordlets_mods.cgi....
What can I do?
Thanks
d-talk
*sigh* I guess Brett didn't update the install.
All of the stuff you added to vars_wordlets_mods.cgi, move that to vars_wordlets.cgi
Thank you verry much Weird All, it works now!!!
Hi,
I have yet another problem with this hack!
Look at:
http://www.ubb-test.board-world.net/cgi-bin/ultimatebb.cgi There ist now one column to much, with the last Post data...
What can I do?
Thanks
d-talk
you need to increase your colspan= number in the code above it... you might re-check the insructions
...but there is no ColSpan in the new code...
the base code
Hi Allen,
can you look at my files when i give you my ftp-datas? Please...
would you do me a favor and just try enabling one more thing to show? ie. Posts Per Forum? I think it's just a miscalculation with the ubb_stastics.cgi code
Hi, now it works, but i dont want to show one more thing...
Also the font is an other as on the left side...
Can you look at my files?
to fix the font size, in ubb_statistics.cgi
FIND:
return qq~</font></td><td align="left" colspan="$statcolspan" width="50%" bgcolor="$vars_style{AltColumnColor1}" valign="top" class="darktable"><font color="$vars_style{TextColor}" face="$vars_style{FontFace}">~;
REPLACE WITH:
return qq~</font></td><td align="left" colspan="$statcolspan" width="50%" bgcolor="$vars_style{AltColumnColor1}" valign="top" class="darktable"><font color="$vars_style{TextColor}" face="$vars_style{FontFace}" size="$vars_style{FDTextSize}">~;
Now this is just something to test, find
$Misc[2] .= &Template($vars_wordlets{statistics_last_post},
{ DATE => &DateFormatJS($Statistics{LastestPost}->[12], $Statistics{LastestPost}->[13], 1, 1, 1, 1),
NAME => $Statistics{LastestPost}[15], SUBJECT => qq~<a href="$ULTIMATEBB?ubb=get_topic;f=$f;t=$t"><b>$Statistics{LastestPost}[3]</b></a>~
});
ADD AFTER:
The first part will work, the second part is untested
It looks just fine by what I see... If there is data for it to be side by side it is, i see just as much data on the left than on the right...
brett, one last bug.
In the title of the statistics page, it says "Statistics", you might want to fix that wordlet in the install
<div class="ubbcode-block"><div class="ubbcode-header">Quote</div><div class="ubbcode-body">quote:</font><hr />Originally posted by d-talk:<br><span style="font-weight: bold">Hi, now it works, but i dont want to show one more thing...<br><br>Also the font is an other as on the left side...<br>Can you look at my files?</span><hr /></blockquote> <blockquote><font class="small">quote:<br>[qb]Originally posted by RandyM:<br><span style="font-weight: bold">I found something that may or may not be a problem but for me it caused the right column of stats on the summary page to have the wrong size font.<br><br>In ubb_statistics.cgi at line 440 you have this;<br><br><div class="ubbcode-block"><div class="ubbcode-header">Code</div><div class="ubbcode-body ubbcode-pre" ><pre><font size="1" face="$vars_style{FontFace}">$Misc[2]</font></pre></div></div>Then on line 670 you close the tags and the <td> to start the next column with this;<br><br><div class="ubbcode-block"><div class="ubbcode-header">Code</div><div class="ubbcode-body ubbcode-pre" ><pre> return qq~</font></td><td align="left" colspan="$statcolspan" width="50%" bgcolor="$vars_style{AltColumnColor1}" valign="top" class="darktable"><font color="$vars_style{TextColor}" face="$vars_style{FontFace}">~; </pre></div></div>Since the size wasn't specified at "1" again it reverted to the boards font size.</span>[/qb]</div></div>
One thing that I think would be beneficial... Allen's script for total members: https://ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=33;t=000114;p=1#000008 possibly integrate the members to reflect that as well, as an option anyway...
I'm glad to see that there is motion in the development of my old hack. You did great work in code improvement. Btw, the sub PerformCheckUp is no longer needed and save to remove.
Thanks for crediting me.
Quick question. If I want to add a break between the stats and the bottom of the main section, where do I go to add that? Other than that, everything runs perfectly!
- MT
I also noted that there is a problem with "Last Post By..." It doesn't update like it's supposed to. Any suggestions?
- MT
Could we have a link to your board and if it requires you to log in, a test account?
Man, I wish I could give you one. I'm working on an Intranet site that is behind some pretty big guns. What is it that you need to see? Maybe I can email you a screenshot?
- MT
Well what do you mean doesn't update like it's supposed to?
Um... nevermind. Man, I overlooked something very obvious.
- MT
Oh, I did forget to ask. I'd like to have a break in between the main board and the stats block. Anyone have any quick suggestions?
- MT
Try to add $TBB
$TBT before the stats part in sub PageBottom of public_forum_summary.pl
Sorry, can't seem to get it to work.....
- MT
quote:
Originally posted by Matt Torbin:
Sorry, can't seem to get it to work.....
- MT
That's what I did
here <--- click this...
I made other changes to the summary page before I added the stats but that is basically what I did.
I have updated the zip file, namely only the ubb_statistics.cgi file fixing the triple column bug and font.
Matt: The html in the summary is located in the ubb_statistics file, not the public_forum_summary. The forum part in particular is around line 428.
add:
$TBB
$TBT
above:
<tr bgcolor="$vars_style{CategoryStripColor}" class="tdheader">
That
should work
quote:
Originally posted by Gizzy:
One thing that I think would be beneficial... Allen's script for total members: https://ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=33;t=000114;p=1#000008 possibly integrate the members to reflect that as well, as an option anyway...
:hint:
I did it in the summary page like this;
sub PageBottom {
# Fixed for strict - 20030426
my $Bottom = &DisplayStats . qq~
$TBB
$TBT
I use graphics around the tables so I didn't have to add a
after $TBB
Added a 6.7 Download Link.
Only thing new is the spider url friendness thingy. Trimmed up some code here and there.
Originally posted by Gizzy:
quote:
[qb]Originally posted by Gizzy:
One thing that I think would be beneficial... Allen's script for total members: https://ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=33;t=000114;p=1#000008 possibly integrate the members to reflect that as well, as an option anyway...[/qb]
:hint:
this is now a standard option in ubb_lib.cgi in 6.7
I know :x... I saw the notice just for you lol...
The install instructions for 6.7 have a buglet or 2, just needs to be updated for 6.7 in regards to finding sections of code in ubb:
$location = qq($vars_wordlets_pntf{pntf_forum}: <a href="$ULTIMATEBB{"ubb=forum;f=$f"}">) . (&GetForumRecord($f))[1] . qq(</a>);
I think there's one other place, but I can't remember right now if I caught one other, but it was the same type thing
Nice work
ZIP file updated with two bugfixs in public_display_profile.pl and public_pntf_admin.pl. Thanks Allen!
Welcome
I've installed this twice and each time I get a 500 ISE on the ultimatebb page. Anyone else seen this? I've chmodded all files correctly
I got it working just fine on my test board.
Would be nice to see it functioning on a 6.7 site, any takers?
I have seen this working on d-talk's test site, but he's added colorforums, so it's been removed
I'll have it up by the weekend.
hmm.. thank you
Did you make any changes from the default install? I have no idea why I got a 500 ise
No changes; did it exactly as the file sais. Only change I did was filing the data in vars_wordlets down in alphabetacal order...
Worked perfectly for me on a new 6.7 install.
ok, thanks... I'll try it again
Found my mistake, thank you
hehe, i have to ask; what was it...
The download link is gone
Sorry, seems hypermart ended all free accounts recently. Gotta get my server up and going so i don't have to worry about these issues.
Originally posted by Brett:
Sorry, seems hypermart ended all free accounts recently. Gotta get my server up and going so i don't have to worry about these issues.
FlareUpload
Originally posted by Brett:
Sorry, seems hypermart ended all free accounts recently. Gotta get my server up and going so i don't have to worry about these issues.
See the wink? Can we say NS35? :x...
For those who want this to work with the fake member total, do this.
In ubb_statistics.cgi,
FIND:
ADD AFTER:
&RequireCode("$vars_config{CGIPath}/ubb_forum_summary.cgi");
FIND:
sub GetMemberCount {
$Statistics{TotalMembers} = &GetMemberTotal;
} # endsub
REPLACE WITH:
sub GetMemberCount {
if($vars_misc{ShowFakeMemberTotal} == 1) {
my @newest = &GetNewestMember;
$Statistics{TotalMembers} = $newest[1] + 0;
} else {
$Statistics{TotalMembers} = &GetMemberTotal;
}
} # endsub
Lol, works perfectly. Be sure to clear your cache however... I hated having my total members up top using the fakemembertotal but the stats using the standard... Made it a pain to prune heh...
Also, for those who'd rather have " Page Views for March 2004:" than "Page Views 2004-03:"
In ubb_statistics.cgi
FIND:
my $bar = int(($Statistics{Hits}{$_} / $Statistics{Hits}{TotalViews}) * $vars_statistics{MaxBarLength});
ADD AFTER:
my $when = $_;
my @when = split(/-/, $when);
$when[1] = $when[1] + 0;
my $month = qq~month_~ . $when[1];
FIND:
$vars_wordlets{statistics_monthly_hits} $_:
REPLACE WITH:
$vars_wordlets{statistics_monthly_hits} for $vars_wordlets_date{$month} $when[0]:
Zip file updated with the fake member update. And the page views for month, year is now based on what user preference the date is on. So depending, you could get 04-2004 or April 2004. And there's other misc updates mainly with the spidering of urls.
The only file to update is ubb_statistics.cgi.
Brett, I was wondering if this would help make the hack less server intensive.
For the page views, how about making it so it uses a vars_statistics_views.cgi that saves the pageviews of older months, as my pageviews from 3 months ago won't change. This would make it so you would only open the one file for all those previous months, instead of at least one file per month. For really old sites that still use this (ie netwerkin), this could lead to a much better experience, wouldn't it?
That way, only the current month would need to have the pageviews be calculated, as it's always changing. Once the month changes, that is added to the vars file and you start the new month.
Sorry in advance if that's a really dumb idea
I'm having issues with this hack and my board is down!
The funny thing is that the statistics page is working fine but I am getting an error screen from my forum home.
Undefined subroutine &main::DisplayStats called at NonCGIPath/Templates/public_forum_summary.pl line 409.
http://www.firearmforums.com/cgi/ultimatebb.cgi Please help!
Make sure you made and uploaded the changes in ubb_forum_summary.cgi.
####################
# In ubb_forum_summary.cgi
####################
Find: #
##############
&set_page_elements;
##############
# Add Below: #
##############
&RequireCode("$vars_config{CGIPath}/ubb_statistics.cgi");
Yeah ... I'm dumarse and uploaded that file to my non-cgi directory instead of my cgi directory. Problem fixed. Thank you so much !
Hi, i've made a test installing this hack on my 6.6 boards and everything seems to be ok but for some issues: the statistics link in the upper line doesn't appear, just the space | |, and i cannot apply my ubb style to the statistics page, what could be wrong? Thanks!
Did you upload the updated vars_wordlets.cgi file?
Hi, yes, i updated it. I've tested it again and i get the same problems, in the Style Template Associations the statistics doesn't appear.
The docummentation says the Style Template Associations is located in: Primary Settings -> Style Templates -> Edit Style but in the 6.6 is located in Styles -> Style Associations. Is that wrong? or the docummentation is wrong?
Help???
Undefined subroutine &main::PageBottom called at CGIPath/ubb_forum_summary.cgi line 374.
I Found the problem to be in the public_forum_summary.pl
That's definitely not the stats hack. I would say rehack from a fresh file.
What is isle 6.7? Why would you need to change ubb_statistics.cgi?
6.7 zip updated with some new adjustments.
-Last topic now directly links to last post.
-Page views only tracks 6 months instead of loading all counter files that may extend further.
MMMK, how about publishing the changes so those of us running it can update our boards without having to rehack everything :x...
reupload ubb_statistics.cgi
I would to have, instead of averages, posts today, yesterday, posts this week, last week and posts this month, last month is it possible to gather such data?
thanks
How would one go about displaying the featured member at the top of public_forum_summary? I tried calling $DisplayFH like at the bottom, that didnt work, then I tried a print command right from ubb_statistics.cgi. No go...
Any ideas..
Charles: Not without diving deeper into the files, but that would require a ton more load, depending on the size of the forum. Because it would need to actually look at the date. The best i could think of is to create a maintaince routine to calculate all posts dates in a forum and append it to a main file with each row being week 1, week 2, so on, seperated by year. And then, increment by new posts. That would be the easiest on load.
Havoq:
# before the print
&FeaturedMember;
# this variable holds featured
$Statistics{FeaturedMember}
Brett,
<tr bgcolor="$vars_style{AltColumnColor2}" class="darktable">
<td width="45%" valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$vars_wordlets{statistics_average_posts}
</font>
</td>
<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$Statistics{ForumStats}[2]
</font>
</td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}" class="lighttable">
<td width="45%" valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$vars_wordlets{statistics_average_topic}
</font>
</td>
<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$Statistics{ForumStats}[1]
</font>
</td>
</tr>~;
should be
<tr bgcolor="$vars_style{AltColumnColor2}" class="darktable">
<td width="45%" valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$vars_wordlets{statistics_average_posts}
</font>
</td>
<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$Statistics{Average}[2]
</font>
</td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}" class="lighttable">
<td width="45%" valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$vars_wordlets{statistics_average_topic}
</font>
</td>
<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$Statistics{Average}[1]
</font>
</td>
</tr>~;
I believe (changing ForumStats to Average)
Originally posted by Brett:
Havoq:
# before the print
&FeaturedMember;
# this variable holds featured
$Statistics{FeaturedMember}
So how do you print it in forum summary? I've tried multiple things. qq~, print command, displayFH = qq~, etc etc
N/M, figured it out:
open
ubb_forum_summary.cgiFind:Add Above:
How many hours can the featured member stay? Whats the max? Because last night, I set it for a specific member at 12:01am. However, it switched members this morning I think around 12pm. Which means thats only 12 hours. I set it to update every 24. Hmmmm...
My featured member isn't even working correctly. I keep setting the user #, and then 1 hour for the random rotation. After an hour, it keeps setting itself to member #1, which is me, and it doesnt change. Very strange....
usually i have problems when i try to modify mine, but this one worked fine! Only problem i found was somehow it doesnt space from my last forum it just kinda goes right into it and looks crammed.. any help on that?
http://www.neverendingrejection.com/cgi-bin/ultimatebb.cgi
Help!
Just installed the stats package on a 6.7 board.
An error has occurred:
Unmatched ( in regex; marked by <-- HERE in m/(2005|2004)-( <-- HERE [01]([0-3]|[10-12])(-dynamic|-cache|).cgi$/ at CGIPath/ubb_statistics.cgi line 684.
try editing the following line in ubb_statistics.cgi
$g_month = $raffle[0] . ']([' . $raffle[1] . "|[$back" . '-12]';
to become
$g_month = $raffle[0] . ']([' . $raffle[1] . "|[$back" . '-12])';
Praise to Ian!
That did it.
Does "Statistics" show page views for a given forum? For instance i want to see which forums are the most popular.
no it does not. refer to my reply to you in the other topic.
Maybe the "hits hack" is what i should try.
that would give you totals, but it wouldn't tell you how many in a certain month
Updated the zip file per Ian's fix. Thankya much!
An error has occurred:
/(2006|2005)-([01]([0-2]|[9-12]))(-dynamic|-cache|).cgi$/: invalid [] range "9-1" in regexp at CGIPath/ubb_statistics.cgi line 684.
Please inform the board administration of this error so that they may fix the problem. Thank you!
AshtarRose / Any who are receiving this error,
I have updated the zip file, with ubb_statistics.cgi having the only changes to fix this bug once and for all.
https://www.ubbdev.com/ubb/upload/00006378/Statistics6.7.zip Let me know if something comes up.