Post Frequency Bar

Started by steve in houston, October 26, 2006, 03:58:47 PM

Previous topic - Next topic

ArkServer

I wish i could say it worked but I guess my admin account is broken ;(

steve in houston

Quote from: ArkServer on October 27, 2006, 01:53:12 PM
I wish i could say it worked but I guess my admin account is broken ;(

::) thats not good.

ArkServer

Hi, i have one more question, does your mod count the message in the archieve/deleted post boards? If not that would be the problem.

steve in houston

Quote from: ArkServer on October 28, 2006, 11:49:30 AM
Hi, i have one more question, does your mod count the message in the archieve/deleted post boards? If not that would be the problem.

it uses the same equation that is on your profile.
if you have those boards set up to count posts, then this will use them.

lemur21

I installed it - everything, apparently, was installed correctly - no errors...

But, now that I'm running it, nothing is happening. Nothing shows up.

I did upload the images to the themes\images directory (since I'm not using default layout).

Should they go in their own folder? I just have them sitting in the main images directory...

(here's a link to my board...unless I'm missing something, it's not showing up):

http://www.libogroup.com/SMF/index.php

Chris

steve in houston

Quote from: lemur21 on October 30, 2006, 11:20:53 AM
I installed it - everything, apparently, was installed correctly - no errors...

But, now that I'm running it, nothing is happening. Nothing shows up.

I did upload the images to the themes\images directory (since I'm not using default layout).

Should they go in their own folder? I just have them sitting in the main images directory...

(here's a link to my board...unless I'm missing something, it's not showing up):

http://www.libogroup.com/SMF/index.php

Chris

did you Enable it in the Admin panel?

lemur21

Under "Features and Options"

I have "Enable frequency bar" - checked
Posting threshold - 20
color - blue

Is there somewhere else I need to activate it?

Chris

steve in houston

no, thats it.

does that theme you use have its own Display.php file in it?
some themes share it with the defaults.

if under your theme folder you see a file called Display.php,
then manually make the changes to that file.

lemur21

I don't have a display.php file.

I DO have a display.template.php file...

Is that what you're asking about? And, if so - which manual changes am I making to it?

Chris

steve in houston

#29
yes, thats what i meant.  sorry.

* This applies to RC3 only display.template.php

Look for this phrase:
// Show avatars, images, etc.

And ADD this code BEFORE the above phrase:
// Frequency Bar
if (!empty($modSettings['frequency_bar_enable'])){
$days_registered = (int) ((time() - $message['dateRegistered']) / (3600 * 24));
if (empty($message['dateRegistered']) || $days_registered < 1){
  $days_registered = 1;  // Skip out on the Divide by Zero error
}
$posts_per_day = comma_format($message['member']['posts'] / $days_registered, 3);
// Calculate bar width
if(empty($modSettings['frequency_bar_max'])){ $modSettings['frequency_bar_max'] = 50; }
$rate = $posts_per_day * (100/$modSettings['frequency_bar_max']);
if($rate>100){ $rate = 100; }

                           echo $txt['frequency_bar_text'].'                         
                                <table border="0" cellpadding="0" cellspacing="0">
                                 <tr onmouseover="this.title=\'', $message['member']['posts'], ' posts (', $posts_per_day, ' posts per day)\'">
                                  <td><img border="0" src="', $settings['images_url'] ,'/freq_bar_l.gif" width="4" height="17" alt="" /></td>
                                  <td width="100" style="background:url(\'', $settings['images_url'] ,'/freq_bar_bk.gif\');background-repeat:repeat-x;"><img border="0" src="', $settings['images_url'] ,'/freq_bar_', $modSettings['frequency_bar_color'] ,'.gif" width="', $rate ,'" height="17" alt="" /></td>
                                  <td><img border="0" src="', $settings['images_url'] ,'/freq_bar_r.gif" width="4" height="17" alt="" /></td>
                                 </tr>
                                </table>
<br />';
}

lemur21

Yep - that did it...thanks a bunch!

I'm still 'new' at figuring out this whole coding thing ;)

Chris

PrizeLive.com

Can this be made for 1.1 rc2?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

steve in houston

Quote from: SurfExcelerator.com on October 30, 2006, 01:05:21 PM
Can this be made for 1.1 rc2?

i dont have that version to test on.
my guess is that it will work.
if you can manually install it and verify that it works,
ill add RC2 as an option.

katzenellenbogen

Strangly it only works for members with less than 1000 posts on my board.
As soon as a member has greater than 1000 postings, it will show an empty line.
I was making the suggested code change in Display.template.php but it didn't solve the problem.
And no, I did not mess up that php file with a strange editor and I also uploaded/replaced it correctly.

katzenellenbogen

OK, I solved the problem. Maybe useful for others:

Admin -> Features / Options -> Default number format -> 1234.00

steve in houston

Quote from: katzenellenbogen on October 31, 2006, 02:54:15 PM
OK, I solved the problem. Maybe useful for others:

Admin -> Features / Options -> Default number format -> 1234.00

yeah, i thought i fixed it by using the comma_format instead of number.
the comma throws the equation off.

ArkServer

Hm, I think you are right about the 1k posts. I just checked and my account and a few others with 1k+ posts have the same problem with the bar. Still.. setting the default number format to 1234.00 didn't help.

steve in houston

alrighty then.
in that case, open display.template.php in the themes directory

find this line:
$posts_per_day = comma_format($message['member']['posts'] / $days_registered, 3);

and add this line just ABOVE it
$message['member']['posts'] = str_replace(",","",$message['member']['posts']);


it will strip the comma.

ill modify the zipped file now

ArkServer

Quote from: steve in houston on October 31, 2006, 06:29:34 PM
alrighty then.
in that case, open display.template.php in the themes directory

find this line:
$posts_per_day = comma_format($message['member']['posts'] / $days_registered, 3);

and add this line just ABOVE it
$message['member']['posts'] = str_replace(",","",$message['member']['posts']);


it will strip the comma.

ill modify the zipped file now

Yup, that did the trick. Awesome!  :-*

kriskd

I got this successfully installed, but had to manaully mod display.php due to a conflict with the Reason for Editing mod.
SMF 2.0.2

Advertisement: