The Arcive of vBulletin Modifications Site. |
|
Number of views per announcement Details »»
|
|||||||||||||||||||||||||
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> <td bgcolor="#F1F1F1"><normalfont>-</normalfont></td> <td bgcolor="#DFDFDF"><normalfont>-</normalfont></td> Code:
<smallfont><br>($announcement[usertitle])</smallfont></td> <td bgcolor="#F1F1F1"><normalfont>-</normalfont></td> <td bgcolor="#DFDFDF"><normalfont>$announcement[visits]</normalfont></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:
![]() Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
YES!! Been wanting something like this for ages
Thanks! Works great
|
|
#3
|
||||
|
||||
|
Great, now we can prove that no one, but no one, reads the announcements.
![]() 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) {
$DB_site->query("UPDATE thread SET views=views+1 WHERE threadid='$threadid'");
} else {
$shutdownqueries[]="UPDATE LOW_PRIORITY thread SET views=views+1 WHERE threadid='$threadid'";
}
|
|
#4
|
||||
|
||||
|
As always, I am most grateful for the wonderful advice.
![]() Thank you.
|
|
#5
|
|||
|
|||
|
Very nice....
Should we wait for a upgrade, so ? ![]() Thnx |
|
#6
|
||||
|
||||
|
Sure.
![]() I'll post an update later tonite.
|
|
#7
|
||||
|
||||
|
also for the forumdisplay.php file, when your trying to find the first part it should be....
PHP Code:
PHP Code:
|
|
#8
|
|||
|
|||
|
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 |
|
#9
|
|||
|
|||
|
ZZed, pleaser release update this wonderful hack!
|
|
#10
|
||||
|
||||
|
Ok, I updated it.
![]() It is all in the original post. And I updated the attachment.
|
![]() |
|
|