if ($announcement=$DB_site->query_first("SELECT announcementid,startdate,title,user.username,user.userid,user.usertitle,user.customtitle
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow AND $forumlist ORDER BY startdate DESC
LIMIT 1")) {
if ($foruminfo[allowratings]) {
$thread[rating]='clear.gif';
eval("\$threadrating = \"".gettemplate('forumdisplaybit_threadrate')."\";");
$backcolor = '#DFDFDF';
$bgclass = "alt2";
} else {
unset($threadrating);
$backcolor = '#F1F1F1';
$bgclass = "alt1";
}
if ($announcement[customtitle]==2)
$announcement[usertitle] = htmlspecialchars($announcement[usertitle]);
$announcement[postdate]=vbdate($dateformat,$announcement[startdate]);
if ($announcement=$DB_site->query_first("SELECT announcementid,startdate,title,user.username,user.userid,user.usertitle,user.customtitle,visits
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow AND $forumlist ORDER BY startdate DESC
LIMIT 1")) {
if ($foruminfo[allowratings]) {
$thread[rating]='clear.gif';
eval("\$threadrating = \"".gettemplate('forumdisplaybit_threadrate')."\";");
$backcolor = '#DFDFDF';
$bgclass = "alt2";
} else {
unset($threadrating);
$backcolor = '#F1F1F1';
$bgclass = "alt1";
}
if ($announcement[customtitle]==2) {
$announcement[usertitle] = htmlspecialchars($announcement[usertitle]);
}
$announcement[postdate]=vbdate($dateformat,$announcement[startdate]);
$announcements=$DB_site->query("
SELECT
announcementid,startdate,enddate,announcement.title,pagetext,user.*,userfield.*
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
FROM announcement
LEFT JOIN user ON user.userid=announcement.userid
LEFT JOIN userfield ON userfield.userid=announcement.userid
".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=announcement.userid","")\
."
WHERE startdate<='$datenow' AND enddate>='$datenow' AND $forumlist ORDER BY startdate DESC");
And replace it with the following:
PHP Code:
$announcements=$DB_site->query("
SELECT
announcementid,startdate,enddate,announcement.title,pagetext,visits,user.*,userfield.*
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
FROM announcement
LEFT JOIN user ON user.userid=announcement.userid
LEFT JOIN userfield ON userfield.userid=announcement.userid
".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=announcement.userid","")\
."
WHERE startdate<='$datenow' AND enddate>='$datenow' AND $forumlist ORDER BY startdate DESC");
Great! I will be looking forward to your solution. Have a great "rest of your vacation" and we'll see you then.
Quote:
Originally posted by Zzed 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.
Boofo, all you have to do is replace your current query statement:
PHP Code:
$announcements=$DB_site->query("SELECT announcementid,startdate,title,user.username,user.userid,user.usertitle,user.customtitle
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow AND $forumlist ORDER BY startdate DESC");
With this:
PHP Code:
$announcements=$DB_site->query("SELECT announcementid,startdate,title,user.username,user.userid,user.usertitle,user.customtitle,visits
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow AND $forumlist ORDER BY startdate DESC");
I just added the visits to the end of the first line.