REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Jump.gif in Portal.php
#1
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
Reply


Messages In This Thread
Jump.gif in Portal.php - by RhymeFront - Feb 21, 2010, 12:56 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  awardcp.php Fatality 0 2,031 Dec 19, 2013, 01:49 AM
Last Post: Fatality
  showstaff.php Salsut 5 4,049 Dec 19, 2013, 01:46 AM
Last Post: Fatality
  portal help Z3R0 1 1,206 Sep 22, 2012, 04:00 PM
Last Post: Z3R0
  Stats and latest thread output to PHP not RSS? blazendevil2 5 2,941 May 06, 2010, 12:50 PM
Last Post: labrocca
  i want the Subscribe.php page Snoopy 6 3,972 Sep 16, 2009, 11:01 PM
Last Post: labrocca

Forum Jump:


Users browsing this thread: 1 Guest(s)