2010-02-20, 10:48 PM
Hello !
I just modified the latest thread box in the Portal.
Now I would like to add this green arrow that show up in the several forum displays, whenever there are new posts..
I managed to build the images in, but they don't lead to the latest UNREAD posts..
I want this green arrow to show up ONLY if in this forum is a new unread post..
I hope you know what I mean, and someone has an idea how to do this!
My MyBB Version: 1.4.11
Link to my Portal:
http://www.rhymefront.net/forum/portal.php
Nobody has a solution ? I just get a tip out of the German support, that i have to look at the usercp.php because there is a query to get the last unread posts but i have no idea how to add this code to the portal.php. Here is a bit of the code i added in the portal.php:
I add a new Template(portal_gotounread) how you see. Add the this link:
And then i added {$gotounread} to the portal_latestthreads_thread. The arrow is shown on the portal.php with the right link to the last post but he is the constantly there ! How can i make that this arrow is just there when there is a NEW reply ? Maan i'm going crazy on this one !
Hope anybody can help me
RF
I just modified the latest thread box in the Portal.
Now I would like to add this green arrow that show up in the several forum displays, whenever there are new posts..
I managed to build the images in, but they don't lead to the latest UNREAD posts..
I want this green arrow to show up ONLY if in this forum is a new unread post..
I hope you know what I mean, and someone has an idea how to do this!
My MyBB Version: 1.4.11
Link to my Portal:
http://www.rhymefront.net/forum/portal.php
Nobody has a solution ? I just get a tip out of the German support, that i have to look at the usercp.php because there is a query to get the last unread posts but i have no idea how to add this code to the portal.php. Here is a bit of the code i added in the portal.php:
// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])
{
$altbg = alt_trow();
$threadlist = '';
$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
);
while($thread = $db->fetch_array($query))
{
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $thread['lastposter'];
}
else
{
$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 40)
{
$thread['subject'] = my_substr($thread['subject'], 0, 40) . "...";
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$thread['threadlink'] = get_thread_link($thread['tid']);
if(!is_array($forum_cache))
{
cache_forums();
}
//Start SHOW THE ARROW JUST WHEN THERE IS A NEW THREAD
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
{
$forum_read = $readforums[$thread['fid']];
$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;
}
}
else
{
$forum_read = $forumsread[$thread['fid']];
}
if($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read)
{
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
}
if($thread['lastpost'] > $cutoff)
{
if($thread['lastpost'] > $cutoff)
{
if($thread['lastread'])
{
$lastread = $thread['lastread'];
}
else
{
$lastread = 1;
}
}
}
if(!$lastread)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if($readcookie > $forum_read)
{
$lastread = $readcookie;
}
else
{
$lastread = $forum_read;
}
}
if($thread['lastpost'] > $lastread && $lastread)
{
$folder .= "new";
$folder_label .= $lang->icon_new;
$new_class = "subject_new";
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("portal_gotounread")."\";");
$unreadpost = 1;
}
else
{
$folder_label .= $lang->icon_no_new;
$new_class = "";
}
$latestthreads['forum'] = htmlspecialchars_uni($forum_cache[$thread['fid']]['name']);
$threadstarter = build_profile_link($thread['username'], $thread['uid']);
eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
$altbg = alt_trow();
}
if($threadlist)
{
// Show the table only if there are threads
eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
}
}
I add a new Template(portal_gotounread) how you see. Add the this link:
<a href="{$thread['newpostlink']}"><img src="{$theme['imgdir']}/jump.gif" alt="{$lang->goto_first_unread}" title="{$lang->goto_first_unread}" /></a>
And then i added {$gotounread} to the portal_latestthreads_thread. The arrow is shown on the portal.php with the right link to the last post but he is the constantly there ! How can i make that this arrow is just there when there is a NEW reply ? Maan i'm going crazy on this one !
Hope anybody can help me
RF