| Forum - recent unread topics |
| Author | Text |
Hakkar.eu Just arrived

Posts: 7

Gender:  Online: No |
Date: 07/10/2008 21:43 Forum - recent unread topics | #post13223 | Hello,
I am one of the developers of hakkar.eu and I would like to have some advice on how to implement a "View New Posts" for each user that lands on the first page on the website. This would avoid them to manually serach for new posts, i think you basically did it since new posts appear in red. Thanks Edited: 09/10/2008 02:28 |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 4642

Gender:  Online: No |
Date: 07/10/2008 22:02 Re: Forum - recent unread topics | #post13226 | I'm planning to rewrite and enhance that peace of code, but i don't know when |
|
 |
| |
Hakkar.eu Just arrived

Posts: 7

Gender:  Online: No |
Date: 07/10/2008 22:09 Re: Forum - recent unread topics | #post13228 | great, but can you tell me what file should i look into to know how you did right now? I'd like to do it myself |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 4642

Gender:  Online: No |
Date: 07/10/2008 22:11 Re: Forum - recent unread topics | #post13229 | pages/forum/index.php, pages/forum/functions.php, blocks/block_forum_main.php |
|
 |
| |
Hakkar.eu Just arrived

Posts: 7

Gender:  Online: No |
Date: 07/10/2008 22:24 Re: Forum - recent unread topics | #post13233 | Thanks, so will I find there the piece of code that makes the new posts red? (just to be sure  ) |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 4642

Gender:  Online: No |
Date: 07/10/2008 22:38 Re: Forum - recent unread topics | #post13234 | Why not? :/ |
|
 |
| |
Hakkar.eu Just arrived

Posts: 7

Gender:  Online: No |
Date: 07/10/2008 22:39 Re: Forum - recent unread topics | #post13235 | Thanks for your patience! |
|
 |
| |
Hakkar.eu Just arrived

Posts: 7

Gender:  Online: No |
Date: 08/10/2008 02:19 Re: Forum - recent unread topics | #post13245 | I think this works, file: forum/index.php
| code | function viewUnread (){
global $dblink, $siteConfig, $admin, $user;
if (isset($_COOKIE['forumtrack'])) {
$cookiecontent = inCode ($_COOKIE['forumtrack']);
$exp = explode("-", $cookiecontent);
$first = $exp[0];
}
$notin= "";
$fontcolor_i = "<font color='#990000'>";
$fontcolor_e = "</font>";
foreach($exp as $cpostnum){
$notin= "". $cpostnum. ", ". $notin;
}
$notin= $notin. "0";
echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' class='std_nicetable'>\n";
echo "<thead>\n";
echo "<tr><td width='70%'>"._THREAD_. "</td><td width='15%' align='center'>"._FORUM_. "</td><td width='5%' align='center'>"._VIEWS_. "</td><td width='10%' align='center' nowrap>"._DATE_. "</td></tr>";
echo "</thead>\n";
echo "<tbody>\n";
$myrank = 0;
if (isUser ($user)) { $myrank = 1; }
if (isAdmin ($admin)) { $myrank = 3; }
$n = 0;
$result = $dblink-> get_list("SELECT p.id,p.lastchild,p.name,f.name as fname, f.id as fid ,DATE_FORMAT(d.date,'". $siteConfig['timestamp']. "') as date,d.author,(SELECT COUNT(*) FROM memht_forum_posts WHERE id=p.id OR parent=p.id) AS pstnum FROM memht_forum_posts AS p JOIN memht_forum_forums AS f JOIN memht_forum_posts AS d ON p.forum=f.id AND p.lastchild=d.id WHERE f.auth_view<=$myrank AND f.auth_read<=$myrank AND p.lastchild>". $first. " AND p.lastchild NOT IN (". $notin. " ORDER BY p.lastchild DESC LIMIT 50");
foreach ($result as $row) {
$bid = intval($row['id']);
$fid = intval($row['fid']);
$blastchild = intval($row['lastchild']);
$btitle = outCode ($row['name'], 0);
$bdate = $row['date'];
$bauthor = outCode ($row['author']);
$pstnum = intval($row['pstnum']);
$frname = outCode ($row['fname'], 0);
$link = "index.php?page=forum&op=viewThread&id=$bid&title=".mem_urlencode ($btitle);
$linkForum = "index.php?page=forum&op=viewForum&id=$fid&title=".mem_urlencode ($frname);
if ($pstnum> 10) { $link .= "&pg=". ceil($pstnum/ 10); }
if ($bid!= $blastchild) { $link .= "#post{$blastchild}"; }
$numbers = getNumbers ($bid);
$replies = $numbers[0];
$views = $numbers[1];
$class = (($n++% 2)!= 0) ? "std_hlight" : "std_clean" ;
echo "<tr><td class='$class' style='font-size:90%;'><a href='$link' title='$btitle'>{$fontcolor_i}<b>$btitle</b>{$fontcolor_e}</a><br>{$fontcolor_i}"._LASTPOST_. " "._BY_. ": $bauthor{$fontcolor_e}</td><td align='center' class='$class' style='font-size:90%;'><a href='$linkForum' title='$frname'>{$fontcolor_i}<b>$frname</b>{$fontcolor_e}</a></td><td align='center' class='$class' style='font-size:90%;'>{$fontcolor_i}$views{$fontcolor_e}</td><td align='center' class='$class' style='font-size:90%;' nowrap>{$fontcolor_i}$bdate{$fontcolor_e}</td></tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
} |
|
|
 |
| |