Modification Name: Unanswered Posts

Version: 1.0

Description: This modification will modify the today.php to give you the option to show you all unanswered posts.

Compatibility: XMB 1.9.5 SP1

Code Designed By: FunForum

License Note: This modification is released under the GPL License v3. 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.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================ 
=======
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 And Delete:
==================

$srchfrom = $onlinetime - 86400;

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

nav($lang['alttodayposts']);

================
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';

================
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, f.fid, f.name FROM $table_threads t LEFT JOIN $table_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, f.fid, f.name FROM $table_threads t LEFT JOIN $table_forums f ON (f.fid=t.fid) WHERE t.tid IN ($tids) $picksqlt ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");

============================================================================================================================
=======
Step 3.
=======
===============
Edit File: misc.php
===============
==========
Find Code:
==========

    } elseif (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/todays_posts.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="'.$imgdir.'/todays_posts.gif" alt="'.$lang['alttodayposts'].'" border="0" /> <a href="today.php"><font class="navtd">'.$lang['navtodaysposts'].'</font></a>';
    $links[] = '<img src="'.$imgdir.'/todays_posts.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="$tablewidth" align="center">
<tr><td bgcolor="$bordercolor">
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%">
<tr class="tablerow">
<td width="50%" bgcolor="$altbg2" style="text-align: center; cursor: pointer;" onClick="location.href='today.php'" onmouseover="this.style.backgroundColor='$altbg1'"; onmouseout="this.style.backgroundColor='$altbg2'";>$lang[alttodayposts]</td>
<td width="50%" bgcolor="$altbg2" style="text-align: center; cursor: pointer;" onClick="location.href='today.php?show=unanswered'" onmouseover="this.style.backgroundColor='$altbg1'"; onmouseout="this.style.backgroundColor='$altbg2'";>$lang[altunanswered]</td>
</tr>
</table>
</td>
</tr>
</table>
<br />

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