PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Ungelesene Beiträge eines bestimmen Nutzers ausgeben


belinea
01.07.2005, 16:47
Mit folgendem Code ist es möglich die Azahl der ungelesenen Beiträge eines Benutzers auszugeben.

Könnte mir jemand helfen das PHP-Script so zu ändern damit es auch noch den Betreff der ungelesenen Beiträge ausgibt?


function getUnreadPosts()
{
global $vbulletin;
$datecut = $vbulletin->userinfo['lastvisit'];

$marking_join = "
LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = " . $vbulletin->userinfo['userid'] . ")
";
$cutoff = TIMENOW - ($vbulletin->options['markinglimit'] * 86400);
$lastpost_where = "
thread.lastpost > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
AND thread.lastpost > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
";
$post_lastpost_where = "
AND post.dateline > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
AND post.dateline > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
";

$threads = mysql_query("
SELECT COUNT(thread.threadid) AS numpost
FROM " . TABLE_PREFIX . "thread AS thread
$marking_join
WHERE
$lastpost_where
AND thread.visible IN (0,1,2)
AND thread.sticky IN (0,1)"
);
$thread = mysql_fetch_array($threads);
return $thread['numpost'];
}
$numnewposts = getUnreadPosts();