PDA

View Full Version : The Activity Hack v2.1


WetWired
12-20-2004, 10:00 PM
vB3.5 and vB3.6 users click here (https://vborg.vbsupport.ru/showthread.php?t=93831)

There will be no additional releases of the vB3/hack version; this mod has moved on to vB3.5 as a plugin (see here (https://vborg.vbsupport.ru/showthread.php?t=93831))

I've been using a less-configurable version of this hack on my forum for over a year. After constant pestering from certain people, here is a version IMO fit for public consumption; consider it a Christmas gift.

Description
This hack adds an activity metric for users to your forum; this metric takes into account a variable number of weeks. Also provided is a Junior/Normal/Senior member system based on this metric, and a longevity metric (user registered time as a percent of the amount of time the first user has been registered).

See zelaron.com (http://zelaron.com/forum/index.php?referrerid=110) for an example of what can be done with this.

Visiting each day and posting the configured amount of times per day for the configured number of weeks will yeild 100% activity. Posts are checked individually for each day, so days cannot be skipped then spammed up afterwards. The weight of visiting for the day relative to posting is configurable. Weeks are weighted so the most recent has a bigger impact on the activity percent than the most distant.

When a user logs in with 50% activity, they are promoted from Junior Member to Member. When they log in 3 months from that time, they are promoted to Senior Member.

Complexity
This hack edits 6 files and 3 templates. The hack adds one table, four fields to the user table, as well as its own settings and phrases.

Technical
This hack adds 1 query to showthread for each user who posts in that page (or only 1 for the logged in user by configuration). 1 query per thread is performed to find join date of first user (this will be changed to a setting in a future version). In addition, the first time a member's post or profile is accessed during a day (GMT), 3 queries are performed to find that user's activity depending on configuration.

Notice
When you first install this hack, no user will have 100% activity because whether or not a user visited on a day is not recorded untill after installation. You may want to set the number of weeks to two at first and increase it as time passes and the visit log fills.

Support
Please click the install link if you install this hack
This hack is in beta because remaining bugs will only become evident over time due to the nature of this hack. I will support this hack in this thread.

3/30/2005
Added barsamples.zip, sample activity and longevity bar images.

Update v2.1
I have fixed the activity calculation so that it adds a fixed 3 queries instead of 16 to 48. To update, simply upload the new activity.php

jamesk
12-21-2004, 05:42 AM
Great Hack and I love the template you're using, It's different.
Does this include the activity bar that you are using on the forum post profile?
I like the Longevity bar too. Is there a hack for that as well?

Boofo
12-21-2004, 07:03 AM
Why don't you use the datastore and save all of those queries? ;)

WetWired
12-21-2004, 12:12 PM
Why don't you use the datastore and save all of those queries? ;)
How would you suggest that I do that? I already use two techniques to minimize queries to the minimum possible. Currently, I use a results cache to insure that activity is only ever computed once per user per page view; I also only compute activity once per day per user, and that only if the information needs to be displayed.

WetWired
12-21-2004, 12:14 PM
Great Hack and I love the template you're using, It's different.
Does this include the activity bar that you are using on the forum post profile?
I like the Longevity bar too. Is there a hack for that as well?
This hack includes support for image based activity and longevity bars, but you must supply the images yourself.

Gio~Logist
12-21-2004, 12:20 PM
That's an extremely nice hack, and looks extra good on YOUR forums with that nice postbit.

dndog
12-21-2004, 04:44 PM
Its a great hack, but it just wont work for busy forums. Those queries would kill my board.

/me would click install if the queries could be greatly reduced.

WetWired
12-22-2004, 01:09 AM
I have much improved activity calculation. It now takes two queries to find the activity, and one to update it in the user table (so it doesn't get calced again during that day).

lange
12-25-2004, 03:49 PM
I love this hack but 32 queries seems too much. I'll test it on a test forum.

Thanks for your Chrismast gift.

WetWired
12-25-2004, 11:35 PM
I love this hack but 32 queries seems too much. I'll test it on a test forum.

Thanks for your Chrismast gift.
32 queries to install. It's done by a script, so it shouldn't even be mentioned in the description.

lasto
12-28-2004, 06:14 PM
what - this hack adds 32 queries when viewing posts - if so then it aint worth installing then.

djjeffa
12-29-2004, 01:17 AM
look good ill wait abit and then install lol

Deaths
12-29-2004, 05:45 PM
Heh , I got a little problem (again) :
I want to use the $acthack_postsd[] thing , but I can't find much instructions about that one , any help on how to use it?

Thanks

WetWired
12-30-2004, 03:51 AM
what - this hack adds 32 queries when viewing posts - if so then it aint worth installing then.
As I said in the post immediately above yours, it's on install. At view, it's two queries plus 2 per user who hasn't had activity updated that day. The dynamic of this is a max of 32 queries per page, which will happen a bit after midnight when the old data is discarded, and 2 queries per page the rest of the day.

I am open to suggestions as to how to further reduce the number of queries. Currently, to find the activity for a user, I need to query the visitlog for visitation data, query the post table to find out when they posted, and query the user table to store the activity information so that it won't be calculated again. The only possibility I can think of is if I can do all the activity for the whole page in two queries and hope that the cost of these two queries is little enough to make them every load instead of storing the results to avoid performing the process over and over; however, I am no SQL wizzard and figuring out how to reduce the process to a flat 2 queries was a stretch of my ability.

WetWired
12-30-2004, 03:59 AM
Heh , I got a little problem (again) :
I want to use the $acthack_postsd[] thing , but I can't find much instructions about that one , any help on how to use it?

All you need to do is enable it in the settings, then use the array in the names of the images, for example, if you made the images
postcleftcap.gif
postcrightcap.gif
postcs.gif
postc0.gif
postc1.gif
postc2.gif
postc3.gif
postc4.gif
postc5.gif
postc6.gif
postc7.gif
postc8.gif
postc9.gif

then, you could use code like this:
<img src="postcleftcap.gif" /><img src="postc$acthack_postsd[1].gif" /><img src="postc$acthack_postsd[2].gif" /><img src="postc$acthack_postsd[3].gif" /><img src="postc$acthack_postsd[4].gif" /><img src="postc$acthack_postsd[5].gif" /><img src="postc$acthack_postsd[6].gif" /><img src="postc$acthack_postsd[7].gif" /><img src="postc$acthack_postsd[8].gif" /><img src="postc$acthack_postsd[9].gif" /><img src="postcrightcap.gif" />
of course, you would want to include the path to the images and width and height attributes so your page loads cleanly. The hack generates 9 digits and represents left padded digits with an 's' .

Deaths
12-30-2004, 04:32 PM
Thanks a lot , now its perfect!

djjeffa
01-01-2005, 11:30 PM
Thanks a lot , now its perfect!
i cant even open these when I dlthem why not put them into one zip file?

MikaK
01-04-2005, 02:29 PM
Handy hack. *installs*. A word of warning for noobs: There is quite a few .TABLE_PREFIX.es missing from the code. These cause sql errors in case of a sqlprfix used and solving the mess might be quite a frustrating task without at least basic knowledge of php and sql. Aside of that - cool, as said.

=M=

Logikos
01-04-2005, 02:49 PM
Thank you WW for releases this to the public, after a year of nagging you. :p

* Logikos clicks install

WetWired
01-05-2005, 04:15 PM
Handy hack. *installs*. A word of warning for noobs: There is quite a few .TABLE_PREFIX.es missing from the code. These cause sql errors in case of a sqlprfix used and solving the mess might be quite a frustrating task without at least basic knowledge of php and sql. Aside of that - cool, as said.

=M=
Is this just in the installer or in the code for the hack itself? As of 2.1, I was fairly certain that I had updated all the queries in activity.php to use TABLE_PREFIX

Logikos
02-07-2005, 06:13 PM
Just want to thank WW once again, and to let everyone know that this hack works perfectly on 3.0.6 if anyone was wondering. Thanks again.

esfron
02-07-2005, 06:59 PM
Thanks. I'll try it.

@WW
It would be nice if you could modify the hack to optionaly merge this request: https://vborg.vbsupport.ru/showpost.php?p=600726&postcount=11. I don't know if this is feasable.

WetWired
02-08-2005, 04:52 PM
So basicly you want integration with promotion/demotion? I'll look into that.

esfron
02-08-2005, 07:34 PM
So basicly you want integration with promotion/demotion? I'll look into that.

Yes. Take a look to https://vborg.vbsupport.ru/showthread.php?t=59965 and at Auto-prune Inactive Members https://vborg.vbsupport.ru/showthread.php?s=&threadid=75740

djjeffa
03-13-2005, 02:23 AM
Yes. Take a look to https://vborg.vbsupport.ru/showthread.php?t=59965 and at Auto-prune Inactive Members https://vborg.vbsupport.ru/showthread.php?s=&threadid=75740
damm I love this hack but i dont know if i could handel it lol

Acers
03-13-2005, 06:49 AM
does this support 3.07?

Originally Posted by MikaK
Handy hack. *installs*. A word of warning for noobs: There is quite a few .TABLE_PREFIX.es missing from the code. These cause sql errors in case of a sqlprfix used and solving the mess might be quite a frustrating task without at least basic knowledge of php and sql. Aside of that - cool, as said.

=M=

Can you elaborate a bit. Has these been fixed in the php file now or if not then where are the errors?

WetWired
03-13-2005, 06:32 PM
I never got a reply from him, but I assume that the problem was just with the installer. I have uploaded a new version of the installer with the table prefixes as of the time of this post. If you don't use table prefixes, this is a non-issue; if you do, I encourage you to post any errors you encounter so that I can correct them.

Acers
03-14-2005, 04:59 PM
hmm ok i am giving this a try then
i will post my experiences soon...

Ski-Whiz
03-26-2005, 11:53 AM
Does anyone have some bar .gif's already?? Just trying to save some time.

WW is it possible to add the ones you have on your site??

Your site looks good, and so does this hack, especially since I'm having trouble with the "time spent" hack. :D

Thanks!

WetWired
03-28-2005, 01:47 PM
I suppose that I could post a cropped version of what I use for activity and longevity, but the today bar is setting-specific.

Ski-Whiz
03-28-2005, 02:38 PM
I suppose that I could post a cropped version of what I use for activity and longevity, but the today bar is setting-specific.


Yeah, I would love the ones for the longevity and activity bar.. :D

Ski-Whiz
03-30-2005, 11:21 AM
Got it to install.. Had to re-read the directions afew times, but I finally got it all to work.. :D

Thanks! This is a great hack, especially since the "Time Spent" hack is flaky for a lot of people, and doesn't work 95% of the time on my board..

Thanks again!

WetWired
03-31-2005, 12:14 AM
I have updated the opening post with a zip with activity and longevity bar images.

Ski-Whiz
03-31-2005, 12:30 AM
I have updated the opening post with a zip with activity and longevity bar images.


Thanks! The hack works GREAT!! *clicks install with ease*

secret1980
04-08-2005, 05:35 AM
is there any demo or screen shot to view wat exactly it looks like ?

WetWired
04-08-2005, 12:22 PM
is there any demo or screen shot to view wat exactly it looks like ?
With text information and rank images:
http://zelaron.com/forum/showthread.php?t=36279&styleid=9
http://zelaron.com/forum/member.php?userid=2792&styleid=9
With activity and longevity bars:
http://zelaron.com/forum/showthread.php?t=36279&styleid=13

87accordlxi
04-13-2005, 07:30 PM
These may be dumb questions:

What is the default post per time period configuration for determining the Activity percentage? How do you change it?

How does the hack determing the longevity percentage? Does it go by member number? Or find the oldest join date and compare everyone else to that?

WetWired
04-15-2005, 03:06 PM
These may be dumb questions:

What is the default post per time period configuration for determining the Activity percentage? How do you change it?

How does the hack determing the longevity percentage? Does it go by member number? Or find the oldest join date and compare everyone else to that?
By default, the activity hack counts the first 4 posts in forums where posts count for each day.

All of the activity hack controls can be accessed from

Admin CP->vBulletin Options->Activity Hack

(If you change numbers, be sure to perform the Refresh User Activity operation from the Update Counters screen, otherwise users' activity will be displayed wrong for the rest of the day)

Longevity is based off of the join date of the user with the oldest join date, the current date, and the join date of the user in question. If you have members with falsified join dates (before the start of the boards), this could be an issue. If the oldest user joined a year ago, and a member joined 6 months ago, then that member would be displayed as having longevity of 50%.

pgowder
05-11-2005, 01:17 PM
We have our own user ranking system. Can this hack be used without having that part of it?

pgowder
05-11-2005, 02:40 PM
The today part is not showing up in everyone's postbit?

It shows up for my profile but not for everyone else??

http://www.powwows.com/gathering/showthread.php?p=558869#post558869

WetWired
05-12-2005, 02:22 AM
This is a setting in the options.
AdminCP>vBulletin Options>Activity Hack>Find today's activity for all users

If you don't put the ranktext part into the memberinfo or postbit templates, then noone will see or be affected by the ranking system.

GrusPer
05-12-2005, 02:37 PM
Greetings
Has put this code
But at me the problem with date base writes that
At me date the base is with
Prefix\Table vb3_mos_ ******
That to me to do what to correct a code

================
Database error in vBulletin 3.0.5:

Invalid SQL: UPDATE user SET activity='54',activitydate='1115856000' WHERE userid=127
mysql error: Table 'grusper_ryzom.user' doesn't exist

mysql error number: 1146

GrusPer
05-12-2005, 11:59 PM
Anybody help me ? pl ppl :)

WetWired
05-14-2005, 06:44 AM
I have updated the activity.php in the original post. Redownload this file and upload it to your server, and the problem should go away.

GrusPer
05-14-2005, 08:54 PM
Database error in vBulletin 3.0.5:

Invalid SQL: SELECT COUNT(*) AS num FROM vb3_mos_post LEFT JOIN thread on post.threadid=thread.threadid LEFT JOIN forum on thread.forumid=forum.forumid WHERE ((forum.options&4096))AND(post.userid=1)AND(post.dateline>=1116028800)
mysql error: Table 'grusper_ryzom.thread' doesn't exist

mysql error number: 1146

:disappointed: :cry:

WetWired
05-15-2005, 03:51 AM
Updated again. Apparently I missed the TABLE_PREFIXes on the joins. It should work now.

GrusPer
05-15-2005, 06:49 PM
Cool thx - all works :)
big thx WetWired

GrusPer
05-16-2005, 04:12 AM
no :( no cool :)
on bug here
----
At attempt of viewing of a subject where ALREADY there is YOUR answer base gives out a mistake.
----------


Database error in vBulletin 3.0.5:

Invalid SQL: SELECT COUNT(*) AS num FROM vb3_mos_post LEFT JOIN vb3_mos_thread on post.threadid=thread.threadid LEFT JOIN vb3_mos_forum on thread.forumid=forum.forumid WHERE ((forum.options&4096))AND(post.userid=117)AND(post.dateline>=1116201600)
mysql error: Unknown table 'forum' in where clause

mysql error number: 1109

Marco van Herwaarden
05-16-2005, 09:07 AM
In your activity.php, find:
$visitlog=$DB_site->query_first("SELECT COUNT(*) AS num FROM '.TABLE_PREFIX.'post LEFT JOIN '.TABLE_PREFIX.'thread on post.threadid=thread.threadid LEFT JOIN '.TABLE_PREFIX.'forum on thread.forumid=forum.forumid WHERE ((forum.options&$_FORUMOPTIONS[countposts]))AND(post.userid=".$userid.")AND(post.dateline>=".($checkend-($days+1)*ACTHACK_ONE_WEEK).")AND(post.dateline<".($checkend-$days*ACTHACK_ONE_WEEK).")");

and replace by:
$visitlog=$DB_site->query_first("SELECT COUNT(*) AS num FROM '.TABLE_PREFIX.'post AS post LEFT JOIN '.TABLE_PREFIX.'thread AS thread on post.threadid=thread.threadid LEFT JOIN '.TABLE_PREFIX.'forum AS forum on thread.forumid=forum.forumid WHERE ((forum.options&$_FORUMOPTIONS[countposts]))AND(post.userid=".$userid.")AND(post.dateline>=".($checkend-($days+1)*ACTHACK_ONE_WEEK).")AND(post.dateline<".($checkend-$days*ACTHACK_ONE_WEEK).")");
Find:
$poststoday=$DB_site->query_first('SELECT COUNT(*) AS num FROM '.TABLE_PREFIX.'post LEFT JOIN '.TABLE_PREFIX.'thread on post.threadid=thread.threadid LEFT JOIN '.TABLE_PREFIX.'forum on thread.forumid=forum.forumid WHERE ((forum.options&'.$_FORUMOPTIONS[countposts].'))AND(post.userid='.$post['userid'].')AND(post.dateline>='.$startofday.')');
and replace by:
$poststoday=$DB_site->query_first('SELECT COUNT(*) AS num FROM '.TABLE_PREFIX.'post AS post LEFT JOIN '.TABLE_PREFIX.'thread AS thread on post.threadid=thread.threadid LEFT JOIN '.TABLE_PREFIX.'forum AS forum on thread.forumid=forum.forumid WHERE ((forum.options&'.$_FORUMOPTIONS[countposts].'))AND(post.userid='.$post['userid'].')AND(post.dateline>='.$startofday.')');

GrusPer
05-16-2005, 11:48 AM
$poststoday=...........

And what picture should be in
today1.gif ?

WetWired
05-16-2005, 12:30 PM
*Sigh*
I guess I need to use a table prefix on my test forums so that I can easily check for propperly compatable queries. Updated activity.php with AS phrases.

TTG
06-07-2005, 10:20 PM
Cool hack .. installed on 3.0.6 with only a few problems.

Had to set it up showing information as text .. the images provided are in the buttons directory but refuse to show.

Problem solved .. had to place button in my skin, button directory .. duh

Clicked install :)

dcarr
08-13-2005, 08:23 PM
Just a question, can the activty percent..be used to enable promotions?
Is there a way to do that? Thank you

WetWired
08-13-2005, 09:46 PM
No, it cannot.

dcarr
08-13-2005, 10:32 PM
Thank you

Anonymous999
08-26-2005, 05:31 PM
Will this work on 3.0.8 ?

Will it show how manu active users i have had ix X (variable) days/weeks ?

Logikos
08-26-2005, 05:51 PM
This should work on 3.0.8

Anonymous999
08-26-2005, 05:54 PM
This should work on 3.0.8


Thanks for that answer

What about my second question active users in X days/weeks ?

Logikos
08-26-2005, 07:37 PM
This hack doesn't do that, but WW did create a small custom mod on his site. http://zelaron.com/forum/zelstat.php?num=50

adill420
10-06-2005, 11:51 PM
great works for 3.0.9 one thing to point out is that..when images are enabled to show it looks for longevityX.gif instead of longX.gif

other than that great one! thanks

panraf
11-14-2005, 08:56 PM
I Want to use the image bars files but i dont know what i have to do so, any help?

WetWired
11-14-2005, 09:12 PM
I Want to use the image bars files but i dont know what i have to do so, any help?

First, DL the images and put them in the "Button images" folder for each style that will use them; you'll need to rename them from longx.gif to longevityx.gif. You can find out where this is by selecting "Stylevars" from the drop down next to the style. After that, follow the install instructions under "TEMPLATES FOR INFORMATION AS IMAGES" instead of following the instructions under "TEMPLATES FOR INFORMATION AS TEXT". You will, of course, need to follow the code modification instructions and run the installer if you havn't already.

jarosciak
01-10-2007, 11:59 PM
I tried to install, accessing acthackinstall.php results in a blank page on vbulletin 3.6.4.
Can someone make this into a product working on 3.6.x?
Joe

WetWired
01-12-2007, 12:03 PM
There will be no additional releases of the vB3/hack version; this mod has moved on to vB3.5 as a plugin (see here (https://vborg.vbsupport.ru/showthread.php?t=93831))This is the thread for the vB3.0 version. You want the 3.5 version indicated in the link in the first post, and yes it works fine with 3.6.