Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2004, 12:20 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Activity Bars

Check this out, I emailed a friend that is a php guru about an activty feature that i want to add to my website. I'll tell you want i wanted, and then post his reply. Its all chinesse to me so maybe someone can translate this a little better to my level, seeing as i only know so much about php.

What i wanted to do was add a color bar on every postbit. Bar starts at green, then goes to yellow, and then finally red. Red being the fullest activty and green being the lowest. The more the user post and vists the site, the more the bar goes up. If for some reason the user lacks in visting the site, then i want the bar to go low. Seeing as the user isn't active anymore. And if he vist more again, the bar goes back up. You get the picture.

So i asked him how i could do this. He said the best way to do this would be by points. 5 points per day. The user gets 1 point automatically just for visting. The the user gets 1 point for each post posted. And is only allowed 4 points per day. To not allow spammers to gain more points. So the maximum amount of points per day equal 5. And heres how he said he would do it.

Quote:
The way that it would work is that in the session code it tracks a users' visiting and puts a record in a new table in the database. All timestamps are rounded to the nearest day and compared against existing records before being added. All of this is only performed if the last activity field for the user indicates yesterday, but the DB check is performed anyway since there were instances of multiple visit records for the same day.

That is how whether a user has visited in a day or not is tracked. You can periodically prune this info based on it's time stamp when it is sufficiently old to not be used in your activity calculations anymore.

The system that will actually track the activity statistic is simply a function that performs queries on the visit log and the post database for each of 4 weeks and performs calculations on the results. Each visit is awarded 3 points for the week, and each undeleted post in a forum that tracks post count is awarded 2 points, up to four per day (each day is individually checked) each week is then multiplied by its own wieght factor then the sum of the last four weeks is divided by the maximum possible value. Activity calculations always exclude the current day.

To save server resources, the last time the activity calculation was performed, rounded to the beginning of the day is stored along with the raw value (before division) in the user's profile. Each time a post is proccessed for display, the timestamp is checked and either the value in the DB is used, or a new value is calculated, accordingly. This way, there is a brief server load spike after midnight GMT as posts by the active members are viewed, and then activity is calculated as needed for the currently inactive members. When doing queries on the raw data, keep in mind that the activity values in the database may be months old if no one has viewed a user's posts recently. When you make changes to the system, you can run a SQL query to set the activity timestamp to 0 to force activity data to be refreshed before any further display.

Hopefully this helps.
I'm lost He has no time to do this. Anyone can help me here?
Reply With Quote
  #2  
Old 08-01-2004, 02:51 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can anyone translate? lol
Reply With Quote
  #3  
Old 08-01-2004, 03:34 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

seems as though hes talking about adding another table to the db which will log all activty by user sorta like the session table but actually hold the data, which can become huge very quickly. unless i misunderstodd he wanted to calculate each day visited as a point and each post as 2 points. sorta hard to follow but i hope i got the jist of it
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03611 seconds
  • Memory Usage 2,188KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete