2008-07-03, 08:55 AM
2008-07-03, 01:05 PM
Hi,
I'm afraid MyBB doesn't keep track of how many users view announcements by default. It would require a code modification.
I'm afraid MyBB doesn't keep track of how many users view announcements by default. It would require a code modification.
2008-07-03, 01:46 PM
(2008-07-03, 01:05 PM)Chris Wrote: [ -> ]Hi,
I'm afraid MyBB doesn't keep track of how many users view announcements by default. It would require a code modification.
Thanks.
Is there anywhere to add this as a feature request?
Am I better attempting this myself or is this feature likely to appear?
2008-07-03, 06:16 PM
2008-07-03, 07:02 PM
Open forumdisplay.php
Find following:
After add following:
Open announcements.php
Find following:
After add following:
Go to AdminCP
Templates => Modify/Delete => Expand Your Template => Forum Display Templates => forumdisplay_announcements_announcement
Find following:
Replace with following:
And then run following query in phpmyadmin:
Note:If you don't use default db prefix(mybb_), you should change prefix with yours.
Find following:
$posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']);
After add following:
$annviews = my_number_format($announcement['views']);
Open announcements.php
Find following:
$lang->forum_announcement = sprintf($lang->forum_announcement, $announcementarray['subject']);
After add following:
$db->query("UPDATE ".TABLE_PREFIX."announcements SET views=views+1 WHERE aid='$aid'");
Go to AdminCP
Templates => Modify/Delete => Expand Your Template => Forum Display Templates => forumdisplay_announcements_announcement
Find following:
<td align="center" class="{$bgcolor}">-</td>
<td align="center" class="{$bgcolor}">-</td>
Replace with following:
<td align="center" class="{$bgcolor}">-</td>
<td align="center" class="{$bgcolor}">{$annviews}</td>
And then run following query in phpmyadmin:
ALTER TABLE `mybb_announcements` ADD `views` INT( 10 ) NOT NULL DEFAULT '0';
Note:If you don't use default db prefix(mybb_), you should change prefix with yours.
2008-07-03, 07:10 PM
I don't see any strong point from adding views to announcement..
but you have made a good instoruction DragonFever.. thanks mate.
but you have made a good instoruction DragonFever.. thanks mate.
2008-07-03, 07:15 PM
No problem buddy. It is unnecessary for me too but he wanted it and i wrote the instructions.
2008-07-04, 12:25 PM
(2008-07-03, 07:15 PM)DragonFever Wrote: [ -> ]No problem buddy. It is unnecessary for me too but he wanted it and i wrote the instructions.
Thanks very much, will try this out and let you know how I get on.
I think it's useful to be able to track how many people are reading announcements as you can't assume that everyone in the forum does. Also, announcements don't show up on View New Posts. (Not a feature request )
olly