Advanced Post Stats
v1.3a for SP1.3-SP1.3.2
This mod adds some extra posting stats to every users profile page.
THIS MOD IS COMPATIBLE WITH SP1.3-SP1.3.2
Example:
696 total posts
0.88% of all forum posts
2.06 posts per day
Of course all the values will change depending on the total posts in your forum, and by the user.
After installation, you can set your forum start date in your forum preferences. That date is used when a user doesn't have a valid registration date.
Version History:
1.3a: fixed html typo in viewprofile
1.3: fixed "number of days registered"-calculation on non-english boards
1.2: fixed "division by zero" error if no posts on the board yet
1.1: added admin option for forum start date
Michael Prager
http://www.boardmod.org
Sources/Profile.pl
if($memsettings[6] > 100000) { $memsettings[6] = "$txt{'683'}"; }
################ START ADVANCED POST STATS MOD ################
if ($yyCatsLoaded ne 1) {
fopen(FILE, "$vardir/cat.txt");
@categories = ;
fclose(FILE);
$yyCatsLoaded = 1;
}
$totalm = 0;
foreach $curcat (@categories) {
chomp $curcat;
fopen(FILE, "$boardsdir/$curcat.cat");
$catname{$curcat} = ;
chomp $catname{$curcat};
$cataccess{$curcat} = ;
chomp $cataccess{$curcat};
@{$catboards{$curcat}} = ;
fclose(FILE);
@membergroups = split( /,/, $cataccess{$curcat} );
$openmemgr{$curcat} = 0;
foreach $tmpa (@membergroups) { if($tmpa eq $settings[7]) { $openmemgr{$curcat} = 1; last; } }
if(!$cataccess{$curcat} || $settings[7] eq 'Administrator') { $openmemgr{$curcat} = 1; }
unless($openmemgr{$curcat}) { next; }
foreach $curboard (@{$catboards{$curcat}}) {
chomp $curboard;
( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($curboard);
$messagecount{$curboard} = $messagecount || 0;
$totalm += $messagecount;
}
}
if ($forumstartdate !~ /^\d\d\/\d\d\/\d\d $txt{'107'} \d\d\:\d\d\:\d\d$/ig) {
$forumstartdate = "10/11/00 at 00:00:00";
}
if ($totalm > 0) {
$postspercentage = sprintf("%.2f", $memsettings[6] / $totalm * 100);
} else {
$postspercentage = sprintf("%.2f", 0);
}
if ($memsettings[14] !~ /^\d\d\/\d\d\/\d\d $txt{'107'} \d\d\:\d\d\:\d\d$/ig) {
$memsettings[14] = $forumstartdate;
}
$date1 = $memsettings[14];
$date2 = $date;
&calcdifference;
$result = $result + 1;
if ($result > 0) {
$postsperday = sprintf("%.2f", $memsettings[6] / $result);
} else {
$postsperday = 0;
}
################ END ADVANCED POST STATS MOD ################
english.lng
1;
%profstatxt = (
'1' => "% of all forum posts",
'2' => "posts per day",
'3' => "Total Posts",
'4' => "Forum Start Date (used for post stats in user profiles if the registration date of the user is not a valid date. Use the 01/01/01 $txt{'107'} 01:01:01<\/b> date\/time format.)"
);
Sources/AdminEdit.pl
# figure out what to print
if ($forumstartdate !~ /^\d\d\/\d\d\/\d\d $txt{'107'} \d\d\:\d\d\:\d\d$/ig) {
$forumstartdate = "10/11/00 $txt{'107'} 00:00:00";
}
$txt{'371'}
$profstatxt{'4'}
# If empty fields are submitted, set them to default-values to save yabb from crashing
$forumstartdate = $FORM{'forumstartdate'} || "10/11/00 $txt{'107'} 00:00:00";
########## Feature Settings ##########
\$forumstartdate = "$forumstartdate"; # Forum start date. Use the "01/01/01 at 01:01:01" date format.