Modification Name: Unanswered Posts

Description: This modification will modify the today.php to give you the option to show you all unanswered posts.
NOTE: THIS MODIFICATION IS NOT INTENDED FOR XMB 1.9.8 SP4 AS IT HAS TOPIC ACTIVITY BUILT IN INSTEAD OF TODAY'S POSTS.

Compatibility: XMB 1.9.8 SP3

Version: 1.0

Code Designed By: FunForum

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Notes: For your own safety you should backup the effected PHP file(s) before proceeding with this installation.

============================================================================================================================ 
=======
Step 1.
=======
=======================
Edit File: /lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Unanswered Posts Mod Begin
$lang['altunanswered'] = "Unanswered Posts";
$lang['onlineunanswered'] = "Viewing Unanswered Posts";
// Unanswered Posts Mod End

============================================================================================================================
=======
Step 2.
=======
================
Edit File: today.php
================
==========
Find Code:
==========

nav($lang['navtodaysposts']);

================
Replace Code With:
================

// Unanswered Posts Mod Begin
$srchfrom = $onlinetime - 86400;
$show = (isset($show) ? (strtolower($show) == 'unanswered' ? 'unanswered' : 'today') : 'today');
if ($show == 'today') {
    nav($lang['alttodayposts']);
    $picksqlo = "lastpost >= '$srchfrom'";
    $picksqlt = '';
} else {
    nav($lang['altunanswered']);
    $picksqlo = "replies = '0'";
    $picksqlt = " && t.replies = '0'";
}
// Unanswered Posts Mod End

==========
Find Code:
==========

WHERE lastpost >= '$srchfrom'

================
Replace Code With:
================

WHERE $picksqlo

==========
Find Code:
==========

    $mpurl = 'today.php?daysold='.$daysold;

================
Replace Code With:
================

    $mpurl = "today.php?show=".$show;

==========
Find Code:
==========

    $query = $db->query("SELECT t.replies+1 as posts, t.tid, t.subject, t.author, t.lastpost, t.icon, t.replies, t.views, t.closed, t.topped, t.pollopts, f.fid, f.name FROM ".X_PREFIX."threads t LEFT JOIN ".X_PREFIX."forums f ON (f.fid=t.fid) WHERE t.tid IN ($tids) ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");

================
Replace Code With:
================

    $query = $db->query("SELECT t.replies+1 as posts, t.tid, t.subject, t.author, t.lastpost, t.icon, t.replies, t.views, t.closed, t.topped, t.pollopts, f.fid, f.name FROM ".X_PREFIX."threads t, ".X_PREFIX."forums f , ".X_PREFIX."posts p WHERE f.fid IN ($fids)$picksqlt AND t.fid=f.fid AND t.lastpost AND p.tid=t.tid GROUP BY t.tid ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");

============================================================================================================================
=======
Step 3.
=======
=======================
Edit File: include/online.inc.php
=======================
==========
Find Code:
==========

    } else if (false !== strpos($url, '/today.php')) {
        $location = $lang['onlinetodaysposts'];


================
Replace Code With:
================

    } elseif (false !== strpos($url, '/today.php')) {
        // Unanswered Posts Mod Begin
        if (false !== strpos($url, 'show=unanswered')) {
            $location = $lang['onlineunanswered'];
        // Unanswered Posts Mod End
        } else {
            $location = $lang['onlinetodaysposts'];
        }

============================================================================================================================
=======
Step 4.
=======
===========================================
Now, you have to see where you want to add a link for this.
I'll give you two options here...
===========================================
=========
Option 1.
=========
=================
Edit File: header.php
=================
==========
Find Code:
==========

// Today's posts-link
if ($SETTINGS['todaysposts'] == 'on') {
    $links[] = '<img src="'.$imgdir.'/top_todaysposts.gif" alt="'.$lang['alttodayposts'].'" border="0" /> <a href="today.php"><font class="navtd">'.$lang['navtodaysposts'].'</font></a>';
}

==================
Replace Code With:
==================

// Today's posts-link
if ( $SETTINGS['todaysposts'] == "on") {
    $links[] = '<img src="'.$THEME['imgdir'].'/top_todaysposts.gif" alt="'.$lang['alttodayposts'].'" border="0" /> <a href="today.php"><font class="navtd">'.$lang['navtodaysposts'].'</font></a>';
    $links[] = '<img src="'.$THEME['imgdir'].'/top_todaysposts.gif" alt="'.$lang['altunanswered'].'" border="0" /> <a href="today.php?show=unanswered"><font class="navtd">'.$lang['altunanswered'].'</font></a>';
}

============================================================================================================================
=========
Option 2.
=========
===========================
Go To Administration --> Templates
===========================
=================
Edit Template: today
=================
==============================
Add To The Beginning Of The Template:
==============================

<table cellspacing="0" cellpadding="0" border="0" width="$THEME[tablewidth]" align="center">
<tr><td bgcolor="$THEME[bordercolor]">
<table border="0" cellspacing="$THEME[borderwidth]" cellpadding="$THEME[tablespace]" width="100%">
<tr class="tablerow">
<td width="50%" bgcolor="$THEME[altbg2]" style="text-align: center; cursor: pointer;" onClick="location.href='today.php'" onmouseover="this.style.backgroundColor='$THEME[altbg1]'"; onmouseout="this.style.backgroundColor='$THEME[altbg2]'";>$lang[alttodayposts]</td>
<td width="50%" bgcolor="$THEME[altbg2]" style="text-align: center; cursor: pointer;" onClick="location.href='today.php?show=unanswered'" onmouseover="this.style.backgroundColor='$THEME[altbg1]'"; onmouseout="this.style.backgroundColor='$THEME[altbg2]'";>$lang[altunanswered]</td>
</tr>
</table>
</td>
</tr>
</table>
<br />

==================
Click Submit Changes
==================
============================================================================================================================
Enjoy!