MyBB Central
Jump.gif in Portal.php - Printable Version

+- MyBB Central (http://www.mybbcentral.com)
+-- Forum: Mybb 1.6x Series Topics (http://www.mybbcentral.com/forum-34.html)
+--- Forum: Mybb 1.6x Official Central Plugins and Hacks (http://www.mybbcentral.com/forum-35.html)
+---- Forum: Requests and Suggestions (http://www.mybbcentral.com/forum-28.html)
+---- Thread: Jump.gif in Portal.php (/thread-4325.html)



Jump.gif in Portal.php - RhymeFront - Feb 21, 2010

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!


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:
PHP Code:
// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != && $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'], 040) . "...";
                }
                
$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'] > && $mybb->user['uid'])
                        {
                                
$forum_read $readforums[$thread['fid']];

                                
$read_cutoff TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
                                if(
$forum_read == || $forum_read $read_cutoff)
                                {
                                        
$forum_read $read_cutoff;
                                }
                        }
                        else
                        {
                                
$forum_read $forumsread[$thread['fid']];
                        }

                        if(
$mybb->settings['threadreadcut'] > && $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:
PHP Code:
<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 ? Maybe you saw that same Thread in the official Supportforum but it seems nobody have a solution there so i hope i god luck here Smile.

RF







My MyBB Version: 1.4.11
Link to my Portal:
http://www.rhymefront.net/forum/portal.php