![]() |
Number of views per announcement
I wasn't able to find this hack anywhere. So I wrote this.
This hack will show the number of views per announcement. Tables affected: announcement Templates affected: forumdisplay_announcement Files affected: forumdisplay.php and announcement.php First we need to add a new field to announcement: alter table announcement add visits smallint(5) unsigned DEFAULT 0 NOT NULL; Then we need to modify forumdisplay_announcement template: Look for the following: Code:
<smallfont><br>($announcement[usertitle])</smallfont></td> Code:
<smallfont><br>($announcement[usertitle])</smallfont></td> Look for the following: PHP Code:
PHP Code:
Look for the following: PHP Code:
PHP Code:
Look for the following: PHP Code:
PHP Code:
|
YES!! Been wanting something like this for ages :D Thanks! Works great :)
|
Great, now we can prove that no one, but no one, reads the announcements. :D
Two things: a) Instead of updating the counter for every announcement, you could just run a query that goes more or less like this: Code:
UPDATE announcement SET visits = visits+1 WHERE forumid IN ($forumlist); b) Use the shutdown queries of vBulletin. :) An example can be found in showthread.php: Code:
if ($noshutdownfunc) { |
As always, I am most grateful for the wonderful advice. :)
Thank you. :) |
Very nice....
Should we wait for a upgrade, so ? :p Thnx |
Sure. ;)
I'll post an update later tonite. :) |
also for the forumdisplay.php file, when your trying to find the first part it should be....
PHP Code:
PHP Code:
|
so any updates for this?
coz i get this error Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/domain/domain119/web/forum/announcement.php on line 34 |
ZZed, pleaser release update this wonderful hack! :)
|
Ok, I updated it. :)
It is all in the original post. And I updated the attachment. :) |
thanks
it's nice |
Zzed! Thanks! I install this hack!
|
Nice hack...
I might install it later if I have the time... Satan |
Unfortunately, the code we have to search for has changed in 2.2.6, and I am reluctant to experiment with it. Zzed, could you provide us with updated instructions?
|
Zzed,
Here is the code I have for the forimdisplay.php part. How do I do the code to replace it? PHP Code:
|
Just got it working for 2.2.6.
forumdisplay.php: Search for: PHP Code:
PHP Code:
Search for: PHP Code:
PHP Code:
Btw, 'morning Boofo. Slept only 3 1/2 hours. :( |
That won't work for me, Sho. I don't have the if ($announcement thing at all.
|
Well, it's for 2.2.6 - you use 2.2.5, if I remember correctly?
|
That's right. :)
|
I'm sorry guys. I am on vacation in Vancouver BC. And my resources are limited. I have this hack working on my 2.2.6. I will have to take a closer look at the problem that was reported by Boofo When I come back this coming weekend. Please accept my apologies.
|
Great! I will be looking forward to your solution. Have a great "rest of your vacation" and we'll see you then. :)
Quote:
|
Boofo, all you have to do is replace your current query statement:
PHP Code:
PHP Code:
|
Thanks Zzed. Sorry about the newbie question. :)
|
You're welcome. :)
|
Does this hack still work for 2.2.8?
|
All times are GMT. The time now is 04:10 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|