View Full Version : vB Forum Counter v2.1
AnhTuanCool
09-28-2004, 10:00 PM
vB Forum Counter
Version: 2.1
vBulletin Version: 3.0.3 (should work with 3.0.0)
Developed by AnhTuanCool
Install difficulty Level: Pretty short
Brief of Description:
vB Forum Counter add an option to have Forum views column on FORUMHOME display forum counter.
Feature:
Feature can be turn on/off
Option to update intermediately or after an hour
Forum counter makes a new column on FORUMHOME
Reset Forum Views
Updated:
For vb Advanced users (attachment)
Updated from version 1:
Fix bugs - conflict between table in database
The function update after one hour not really works
Update to version 2.1:
Add Reset feature
Screenshot:
In attachments...
Install:
Attachment also
Don't forget to click install if you use this hack INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=69971) ;)
If you got any problem or questions, just post it right here, I'm willing to help :)
Note: If you have problem with sql error in vb Advanced CMPS, then check out the txt file in attachment below, show how to fix it ;)
There is no uninstall script so if you want to update then just see the updating instruction.
Enjoy!
Johnny
09-29-2004, 12:20 AM
prettty cool hack, just a few questions before i install this one...
how does it count. does it count for each click per member and guest?
and are you able to reset the stats?
Holidazed
09-29-2004, 01:05 AM
Works like a charm. Thanks
MrLister
09-29-2004, 06:45 AM
Nice thanks
Freezerator
09-29-2004, 08:15 AM
Sorry to ask this, but can you make this for links only? Like redirects since or something?
Sorry to ask this, but can you make this for links only? Like redirects since or something?
Yeah, this would be nice :)
Zachery
09-29-2004, 11:23 AM
Zajako made one for the links, :)
AnhTuanCool
09-29-2004, 12:30 PM
I think it's just like the normal forum cause the browser must get in forumdisplay.php first anyway right :)
Neutral Singh
10-01-2004, 07:30 AM
I have installed vBadvanced CMPS and I am getting the following error...
Database error in vBulletin 3.0.3:
Invalid SQL:
SELECT
thread.threadid, thread.title, thread.replycount, postusername, postuserid, thread.dateline AS postdateline, IF(views <= thread.replycount, thread.replycount+1, views) AS views, thread.lastposter, thread.lastpost, pollid
, thread.iconid AS threadiconid, iconpath AS threadiconpath
,thread.forumid, forum.title AS forumtitle
, post.pagetext AS preview
, NOT ISNULL(subscribethread.subscribethreadid) AS subscribed
FROM thread as thread
LEFT JOIN icon USING (iconid)
LEFT JOIN forum AS forum ON (thread.forumid = forum.forumid)
LEFT JOIN post AS post ON (post.postid = thread.firstpostid)
LEFT JOIN deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
LEFT JOIN subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = 1)
WHERE open <> '10' AND thread.visible = 1 AND deletionlog.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT 10
mysql error: Column: 'views' in field list is ambiguous
Holidazed
10-01-2004, 11:39 AM
I am having the exact same problem. I have disabled my CMPS for now, but still need a solution.
Help
AnhTuanCool
10-01-2004, 08:13 PM
Run this query:
ALTER TABLE `forum` CHANGE `views` `view` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL
Open file ./includes/functions_forumlist.php
Find:
$forumfields = 'forum.forumid, views, lastpost, lastposter, lastthread, lastthreadid, lasticonid, threadcount, replycount';
Replace with:
$forumfields = 'forum.forumid, view, lastpost, lastposter, lastthread, lastthreadid, lasticonid, threadcount, replycount';
Save up.
Open forumdisplay.php
Find:
// ############################### Forum counter by AnhTuanCool ###############################
if ($vboptions['forumviewslive'])
{
// doing it as they happen
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "forum
SET views = views + 1
WHERE forumid = " . intval($foruminfo['forumid'])
);
}
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "views (forumid)
VALUES (" . intval($foruminfo['forumid']) . ')'
);
}
Replace with:
// ############################### Forum counter by AnhTuanCool ###############################
if ($vboptions['forumviewslive'])
{
// doing it as they happen
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "forum
SET view = view + 1
WHERE forumid = " . intval($foruminfo['forumid'])
);
}
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "view (forumid)
VALUES (" . intval($foruminfo['forumid']) . ')'
);
}
Save up
Open template forumhome_forumbit_level2_post
Find
$forum[views]
Replace with:
$forum[view]
Save up and problem solved :)
Holidazed
10-01-2004, 09:55 PM
Sweet!! Thank you
royals
10-03-2004, 02:45 AM
If someone has the main forum saved in their favorites, instead of the directory - will it count as a hit? they aren't actually clicking on the link - they are already in the forum.
AnhTuanCool
10-03-2004, 02:49 AM
Everytime the file forumdisplay.php loaded, it will count as a hit.
Johnny
10-03-2004, 04:02 AM
If someone has the main forum saved in their favorites, instead of the directory - will it count as a hit? they aren't actually clicking on the link - they are already in the forum.
thats the whole point is to keep track on how many views your getting to that particular fourms. it basicly works the sameway with your showthread views counter works.
Holidazed
10-04-2004, 01:58 PM
Since I installed this hack, I get a database error.
_________________________________
Database error in vBulletin 3.0.3:
Invalid SQL:
SELECT forum.title AS forumtitle, thread.threadid, thread.title, thread.dateline,
thread.lastpost, pollid, open, thread.replycount, postusername, postuserid,
thread.lastposter, thread.dateline, views
FROM forum AS forum
INNER JOIN thread AS thread USING(forumid)
LEFT JOIN deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
WHERE FIND_IN_SET('16', forum.parentlist) AND
thread.lastpost > 1096689607 AND
thread.visible = 1 AND
deletionlog.primaryid IS NULL
mysql error: Column: 'views' in field list is ambiguous
mysql error number: 1052
AnhTuanCool
10-04-2004, 07:59 PM
Hmm, where did you get that error report, bitg?
If it said column views is amibguous then you just change the name of the column and change some other things around so answer me the first question, I'll find out next for ya ;)
Holidazed
10-04-2004, 08:08 PM
Hmm, where did you get that error report, bitg?
If it said column views is amibguous then you just change the name of the column and change some other things around so answer me the first question, I'll find out next for ya ;)
I do not know. it us happening from an unregistered user. It started after I installed this hack.
AnhTuanCool
10-04-2004, 09:28 PM
Did you do the one update for your CMPS Portal?
Holidazed
10-04-2004, 09:38 PM
Yes, but this error is coming from another site I work on that does not run the cmps.
Zachery
10-04-2004, 10:32 PM
Yes, but this error is coming from another site I work on that does not run the cmps.
Stop using unstable versions of mysql for starters bitg ;)
AnhTuanCool
10-04-2004, 10:55 PM
To bitg - I've just finished the upgrade_to_v2.txt instruction at the first post so I recommend you do it so. Good luck :)
Holidazed
10-04-2004, 11:28 PM
Stop using unstable versions of mysql for starters bitg ;)
Unstable version? What unstable version? I did not pick the version? This is not MY server? It is a hosting plan just like any other? What are you talking about?
AnhTuanCool
10-08-2004, 05:29 PM
prettty cool hack, just a few questions before i install this one...
how does it count. does it count for each click per member and guest?
and are you able to reset the stats?
I updated the hack, now you can use Reset Forum Views feature to reset the stats, just see the new reset_forum_views.txt instruction. Have fun ;)
Ber|Art
10-15-2004, 12:10 PM
Thx, works perfectly! :)
I really like this, but is there a way to keep the hits you already have, or add them in -
I don't want my hits starting at 1 when I've already got 50,000 -
thx
AnhTuanCool
01-12-2005, 09:05 PM
If you want just start your forum's hits from 50,000 instead of 1 then run this query
UPDATE forum SET views = 1 WHERE forumid = 34
With views = 1, replace 1 with the the number you want it to start at, and forumid = 34 replace 34 with the forum's id you wanna update. Thanks,
Ha - that's great! thx Anh -
1 final ? - integer doesn't have a comma shows as 10001 - any way to display as 10,001?
AnhTuanCool
01-12-2005, 10:48 PM
It has to go through a function process llike vb_number_format() to shown as interger with , etc...
You can do it so
Open forumroot/includes/functions_forumlist.php
Find:
$forum['threadcount'] = vb_number_format($forum['threadcount']);
Add below:
$forum['views'] = vb_number_format($forum['views']);
Thanks,
hey - you did it - thx! :up:
Since I installed this hack, I get a database error.
_________________________________
Database error in vBulletin 3.0.3:
Invalid SQL:
SELECT forum.title AS forumtitle, thread.threadid, thread.title, thread.dateline,
thread.lastpost, pollid, open, thread.replycount, postusername, postuserid,
thread.lastposter, thread.dateline, views
FROM forum AS forum
INNER JOIN thread AS thread USING(forumid)
LEFT JOIN deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
WHERE FIND_IN_SET('16', forum.parentlist) AND
thread.lastpost > 1096689607 AND
thread.visible = 1 AND
deletionlog.primaryid IS NULL
mysql error: Column: 'views' in field list is ambiguous
mysql error number: 1052
getting exact same error - any thoughts?
nevermind update fixed it
venomx
02-24-2005, 09:21 AM
For vbadvance cmps shouldnt
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "views (forumid)
VALUES (" . intval($foruminfo['forumid']) . ')'
also change to
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "view (forumid)
VALUES (" . intval($foruminfo['forumid']) . ')'
?
Has anyone updgraded to 3.07 with this hack? I just upgraded to vb 3.07 & can't get the views column to appear - it just doesn't show up - do you know what I could check?
for anyone using 3.07, I also had to go into includes/functions_diget.php & remove the , views after thread.lastposter, thread.dateline
Marco van Herwaarden
04-15-2005, 06:51 AM
The error you got before means that the 'views' column exist in more then 1 table used in the query. If you don't tell MySQL from which table you want to use that column, it won't have a clue what you are look for.
Solution:
Change 'views' into 'thread.views'
(Assuming that you are looking for the view count on the threads.)
eXtremeTim
04-22-2005, 04:23 AM
Great hack. Would be nice to have a combined install file and not just the upgrade version. I would release the combined version I made but I made changes to it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.