Advanced Post Stats v1.4 for SP1.3-SP1.4 This mod adds some extra posting stats to every users profile page. THIS MOD IS COMPATIBLE WITH SP1.3-SP1.4 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.4: % of all forum posts was not properly calculated if private boards exist. Now posts from all boards (also private boards) will be taken into account when calculating. This backdraw had to be taken to prevent serious slowdown when displaying profiles. 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); 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 ################ $txt{'86'}: $memsettings[6] $txt{'86'}: $memsettings[6] $profstatxt{'3'}
$postspercentage$profstatxt{'1'}
$postsperday $profstatxt{'2'}
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.