Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Marcus Forsberg in November 08, 2008, 05:21:47 NACHMITTAGS

Titel: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in November 08, 2008, 05:21:47 NACHMITTAGS
Greetings!

This simple tip will show you how to put a Activity Level bar in each post.
The bar width increases by 1px for every post the member does.
When it reach 100px, it stops.
It works whit both SMF series.




Let's get started by opening ./Themes/default/Display.template.php and find the following line:
// Show avatars, images, etc.?

Got it?  ;)
Then replace that line whit this code:
// The Activity bar... Small.... Simple... And made by Nascar :)
echo '                                  <b>', $txt['activity_level_posts'], '</b><br />
<img src="'.$settings['images_url'].'/poll_left.gif"><img src="'.$settings['images_url'].'/poll_middle.gif" height="12px" width="', ($message['member']['posts'] < 100) ? $message['member']['posts'] : 100, '" title="', $txt[26], ': ', $message['member']['posts'], '"><img src="'.$settings['images_url'].'/poll_right.gif"><br />
<br />';

// Show avatars, images, etc.?





You should have a bar displaying in each topic now, right?
Then head for ./Themes/default/languages/Modifications.english.php and add this right before ?>:
$txt['activity_level_posts'] = 'Activity Level';




We're done! Yey! ;D
In the feature I'll develop this tip in to a mod whit various admin features and more bars, based on different stats.

Also, a big thanks goes to:
Deprecated - Code help
geneiuk - Testing
MaxiPes - Requester


Enjoy
Nascar
Titel: Re: [Tip] Activity Level in posts
Beitrag von: genieuk in November 08, 2008, 05:42:21 NACHMITTAGS
Great Modification. Simple yet useful.  ;)

Works Great!

Mathew
Titel: Re: [Tip] Activity Level in posts
Beitrag von: ascaland in November 08, 2008, 05:45:20 NACHMITTAGS
Interesting. :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: TheDisturbedOne in November 08, 2008, 06:16:36 NACHMITTAGS
I think it is good, but I would like to see a bit more, if and when you upgrade it.  Like when you don't post for a while it goes down.
Good job anyway!
Titel: Re: [Tip] Activity Level in posts
Beitrag von: MaXiForum.cz in November 09, 2008, 03:43:18 VORMITTAG
It is amazing!!!
THX Nascar
I test this :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Jessikard in November 09, 2008, 10:59:22 VORMITTAG
great - thx
and if it´s possible when you update please with a little bit more differences inside the levels
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in November 09, 2008, 11:34:22 VORMITTAG
Thanks for the comments!
This is just a small and fast solution to this. More adavanced features are comming..
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Jessikard in November 09, 2008, 11:41:21 VORMITTAG
well, so i´m waiting for your great work  ;)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Costa in November 09, 2008, 05:06:13 NACHMITTAGS
Nascas, a litlle sugestion

Can you make another bar?
turning from red to green?
And the activity can be measure by month?

Farewell and congrats for the tip
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Deprecated in November 09, 2008, 05:29:40 NACHMITTAGS
How about making the activity indicator go in three sections? Like 1-100, 100-1000, 1000-10000, but equal widths. You could make the readout scale logarithmic. :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: genieuk in November 09, 2008, 09:01:00 NACHMITTAGS
Zitat von: Costa in November 09, 2008, 05:06:13 NACHMITTAGS
Nascas, a litlle sugestion

Can you make another bar?
turning from red to green?
And the activity can be measure by month?

Farewell and congrats for the tip

Hi,

I have created some poll bars in different colours:

http://www.simplemachines.org/community/index.php?topic=273419.0

Regards,
Mathew
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Deprecated in November 09, 2008, 10:45:43 NACHMITTAGS
Can somebody please do this mod in ultraviolet light for me? It would look great with my black light posters and lava lamps. ;) :P
Titel: Re: [Tip] Activity Level in posts
Beitrag von: MaXiForum.cz in November 10, 2008, 04:32:32 VORMITTAG
Zitat von: Deprecated in November 09, 2008, 05:29:40 NACHMITTAGS
How about making the activity indicator go in three sections? Like 1-100, 100-1000, 1000-10000, but equal widths. You could make the readout scale logarithmic. :)

   
good idea, how?
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Deprecated in November 10, 2008, 10:41:19 VORMITTAG
http://en.wikipedia.org/wiki/Logarithm
http://us2.php.net/log
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Jade Elizabeth in November 10, 2008, 10:48:22 VORMITTAG
I love this idea, but my forum is FULL of spammers...

The bar width increases by 1px for every post the member does.
When it reach 100px, it stops.

^ So that wouldnt work. Unless by changing the "100" parts of the code I could increase it?
Titel: Re: [Tip] Activity Level in posts
Beitrag von: genieuk in November 10, 2008, 10:58:09 VORMITTAG
You could increase yes, very easily but if you do the bar becomes to wide and disrupts the page look. The bar increases 1px every time a post is made, once it reaches 100 it stops, if you increase any further than 100 it will as stated go to long and things start looking horrible and messy.

Nascar is working on several otherthings to improve it and the idea of having 3 bars is good as that way 3 bars can increase.

Example:

bar one, once it reaches 100 it stops (like it currently does) and then it starts on next bar.

I did modify the code earlier to test i got 3 bars showing but when i change the values of the two others nothing happens this is because it needs a bit of extra tweaking to increase second and third bar. Only way i could get it to increase was by changing the px width of the second and third bar which is useless.

Mathew
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Jade Elizabeth in November 10, 2008, 11:00:28 VORMITTAG
I mean, if it increases per post, can I increase that? To like 100 or 500 or 1000 posts?  I'd only want the bar 125px long :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Deprecated in November 10, 2008, 11:06:53 VORMITTAG
See my post above regarding logarithms. If you make the scale logarithmic it doesn't have to stop at 100. You could have for example a 3 inch area for the indicator where 0 to 1 inch represents 1-100 posts, 1 inch to 2 inches represents 100-1000 posts, and 2 inches to 3 inches represents 1000-10000 posts. I think you can see how it gets more compressed at the upper end, yet still shows small changes at the lower end.

I expect 3 inches is too big for this application but it could be scaled to whatever is desired. Colors could be added too.

It's Nascar's project so I'm not going to do anything beyond making suggestions. He's a budding mathematics expert and figuring this out would be good for his learning. :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: genieuk in November 10, 2008, 11:25:34 VORMITTAG
I agree, now you explained it, it would make sence and the ability to extend it beyond 100 with no increase in bar width.

I think Nascar will also agree with this.

MAthew
Titel: Re: [Tip] Activity Level in posts
Beitrag von: MaXiForum.cz in November 12, 2008, 11:04:08 VORMITTAG
Hi, my friend and admin www.maxiforum.cz modificated it this way:

http://princ.name/temp/activity-bar.xml
or
http://www.maxiforum.cz/activity-bar.xml

There is screen:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fmegaupload.cz%2Fimages%2FtYnprofil.jpg&hash=41f591496327afb2f953bc816a4564615f121520)

THX Nascar, Deprecated and Jaa(c) :)
PS: install it by hand ;)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Jaa(c) in November 12, 2008, 11:13:26 VORMITTAG
If you are interested how does it count the bar length:
It takes the user with top posts, than it counts the percentage of single user posts.
Then its set that the useres with 90% - 100% has 90% of the width (of the profile column), users with 0 posts have 10%..  Other user are between :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Burke ♞ Knight in November 12, 2008, 01:00:52 NACHMITTAGS
I really think this as a mod on the Mod Site will be a BIG hit. :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: TheDisturbedOne in November 12, 2008, 07:53:54 NACHMITTAGS
If it were to be a MOD I think it should have more features.
Nascar has a lot of MODs that he's already doing
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Deprecated in November 13, 2008, 01:07:58 VORMITTAG
If anybody has designs on this as a mod you should contact Nascar first, okay? :) He has dibs. :)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: _Anthony_ in Januar 20, 2009, 04:00:01 VORMITTAG
Zitat von: Jade in November 10, 2008, 11:00:28 VORMITTAG
I mean, if it increases per post, can I increase that? To like 100 or 500 or 1000 posts?  I'd only want the bar 125px long :)
Hint: / DIVISOR
;)
If you still need more help ask me.


         // The Activity bar... Small.... Simple... And made by Nascar :)
         echo '                                  <b>Activity Levels</b><br />
                        Based first 100 posts (1 post)<br /><img src="'.$settings['images_url'].'/poll_left.gif"><img src="'.$settings['images_url'].'/poll_middle.gif" height="12px" width="', ($message['member']['posts'] < 100) ? $message['member']['posts'] : 100, '" title="', $txt[26], ': ', $message['member']['posts'], '"><img src="'.$settings['images_url'].'/poll_right.gif"><br />';

if($message['member']['posts'] > 100) {
echo '100-1000 posts (10 posts)<br /><img src="'.$settings['images_url'].'/poll_left.gif"><img src="'.$settings['images_url'].'/poll_middle.gif" height="12px" width="', (($message['member']['posts'] - 100) / 9 < 1000) ? ($message['member']['posts'] - 100) / 9 : 100, '" title="', $txt[26], ': ', $message['member']['posts'], '"><img src="'.$settings['images_url'].'/poll_right.gif"><br />';
}
if($message['member']['posts'] > 1000) {
echo '1000+ posts (100 posts)<br /><img src="'.$settings['images_url'].'/poll_left.gif"><img src="'.$settings['images_url'].'/poll_middle.gif" height="12px" width="', (($message['member']['posts'] - 1000) / 90 < 1000) ? ($message['member']['posts'] - 1000) / 90 : 100, '" title="', $txt[26], ': ', $message['member']['posts'], '"><img src="'.$settings['images_url'].'/poll_right.gif"><br />';
}

What I use for my forums :P
Titel: Re: [Tip] Activity Level in posts
Beitrag von: sreisenb001 in Januar 30, 2009, 06:36:03 NACHMITTAGS
I made the changes just like the first post and nothing changed... Now what?

www.mnsportscentral.com (http://www.mnsportscentral.com)
Titel: Re: [Tip] Activity Level in posts
Beitrag von: HR in Februar 16, 2009, 06:26:25 NACHMITTAGS
What is txt26? Nothjing showing up for me
Titel: Re: [Tip] Activity Level in posts
Beitrag von: JBlaze in April 24, 2009, 06:17:24 VORMITTAG
Zitat von: HR in Februar 16, 2009, 06:26:25 NACHMITTAGS
What is txt26? Nothjing showing up for me

http://huw.org.uk/smfstrings

Try looking in there.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Informatics in Mai 05, 2009, 01:23:02 NACHMITTAGS
maybe is should try this tips. thanx.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: chrishicks in Mai 05, 2009, 07:41:52 NACHMITTAGS
subscribing for future reference...
Titel: Re: [Tip] Activity Level in posts
Beitrag von: chrisb in Mai 10, 2009, 04:57:39 VORMITTAG
are we going to look at doing any new changes to the tip and improve on this mod for the site
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Joe N in Mai 10, 2009, 05:01:25 VORMITTAG
Hey nas

If your using a custom theme, do you just add it to there
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in Mai 23, 2009, 10:15:39 VORMITTAG
@chrisb
It was a long time ago I made this. I might rebuild it and submit it as a mod some time, but not soon.

@Joe N
Yes, if you are using a custom theme, make the same edits.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in Juni 30, 2009, 11:52:21 VORMITTAG
This has been recoded and added to the mod site:
http://custom.simplemachines.org/mods/index.php?mod=1929
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Joe N in Juni 30, 2009, 12:43:30 NACHMITTAGS
Nice Nas

smf 1?
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in Juni 30, 2009, 12:45:54 NACHMITTAGS
SMF 1.1.x version is comming.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: hmalik007 in Juni 30, 2009, 02:26:54 NACHMITTAGS
Thx for adding it to mod site.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: [Core] in Juni 30, 2009, 10:55:06 NACHMITTAGS
Interesting. Thanks
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Marcus Forsberg in Juli 01, 2009, 12:06:20 NACHMITTAGS
SMF 1.1.x version released.
Titel: Re: [Tip] Activity Level in posts
Beitrag von: Joe N in Juli 01, 2009, 12:07:17 NACHMITTAGS
Cheers Nas