============================================================================================================================
Modification Title: Theme Based Thread Options

Version: 1.0

Author: John Briggs & John Clawson

Last Updated: 07/09/10

Description:
This modification will add the ability to specify the use of text or images display for thread options (Printable, Subscribe, Add to Favorites) within each theme.

Supported Version: XMB 1.9.5 SP1

Installation Note: Before adding this modification to your forum, you should back up all files related to this modification.

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

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this modification.
Downloading this modification from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage will not offer support for modifications not offered in our Request List.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

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

// Theme Based Thread Options Mod Begin
$lang['threadoptstatus'] = 'Thread Options Display:';
$lang['threadopttext'] = 'Text';
$lang['threadoptimage'] = 'Image';
// Theme Based Thread Options Mod End

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

        $themestuff = $db->fetch_array($query);

===============
Add Code Below:
===============

        // Theme Based Thread Options Mod Begin
        $threadopts_image = $threadopts_text = '';
        if ($themestuff['threadopts'] == 'image') {
            $threadopts_image = 'selected="selected"';
        } else {
            $threadopts_text = 'selected="selected"';
        }
        // Theme Based Thread Options Mod End

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

        <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
        <td><?php echo $lang['texthemename']?></td>
        <td colspan="2"><input type="text" name="namenew" value="<?php echo $themestuff['name']?>" /></td>
        </tr>

===============
Add Code Below:
===============

        <!-- Theme Based Thread Options Mod Begin -->
        <tr class="tablerow" bgcolor="<?php echo $altbg2?>">
        <td><?php echo $lang['threadoptstatus']?></td>
        <td colspan="2">
        <select name="threadoptsnew">
        <option value="text" <?php echo $threadopts_text?>><?php echo $lang['threadopttext']?></option>
        <option value="image" <?php echo $threadopts_image?>><?php echo $lang['threadoptimage']?></option>
        </select>
        </td>
        </tr>
        <!-- Theme Based Thread Options Mod End -->

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

        <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
        <td><?php echo $lang['texthemename']?></td>
        <td><input type="text" name="namenew" /></td>
        </tr>

===============
Add Code Below:
===============

        <!-- Theme Based Thread Options Mod Begin -->
        <tr class="tablerow" bgcolor="<?php echo $altbg2?>">
        <td><?php echo $lang['threadoptstatus']?></td>
        <td colspan="2">
        <select name="threadoptsnew">
        <option value="text"><?php echo $lang['threadopttext']?></option>
        <option value="image"><?php echo $lang['threadoptimage']?></option>
        </select>
        </td>
        </tr>
        <!-- Theme Based Thread Options Mod End -->

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

 WHERE themeid='$orig'");

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

, threadopts='$threadoptsnew' WHERE themeid='$orig'");

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

) VALUES('', '$namenew'

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

, threadopts) VALUES('', '$namenew'


====================
Find Code On Same Line:
====================

)");

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

, '$threadoptsnew')");

============================================================================================================================
=======
Step 4:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

if (!$action) {
    if (X_MEMBER && $self['sig'] != '') {
        $usesig = true;
    }

    eval('echo "'.template('header').'";');

===============
Add Code Below:
===============

    // Theme Based Thread Options Mod Begin
    if (X_MEMBER || X_GUEST){
        if ($threadopts == 'image') {
            $nonmemthreadopts = "<a href=\"viewthread.php?fid=$fid&amp;tid=$tid&amp;action=printable\"><img src=\"$imgdir/print.gif\" border=\"0\" title=\"$lang[textprintver]\" /></a>";
        } else {
            $nonmemthreadopts = "<a href=\"viewthread.php?fid=$fid&amp;tid=$tid&amp;action=printable\">$lang[textprintver]</a>";
        }
    }

    if (X_MEMBER) {
        if ($threadopts == 'image') {
            $memthreadopts = " <a href=\"memcp.php?action=subscriptions&subadd=$tid\"><img src=\"$imgdir/subscribe.gif\" border=\"0\" title=\"$lang[textsubscribe]\" /></a> <a href=\"memcp.php?action=favorites&amp;favadd=$tid\"><img src=\"$imgdir/favorites.gif\" border=\"0\" title=\"$lang[textaddfav]\" /></a>";
        } else {
            $memthreadopts = " | <a href=\"memcp.php?action=subscriptions&amp;subadd=$tid\">$lang[textsubscribe]</a> | <a href=\"memcp.php?action=favorites&amp;favadd=$tid\">$lang[textaddfav]</a>";
        }
    }
    // Theme Based Thread Options Mod End

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
====================
Edit Template: viewthread
====================
==========
Find Code:
==========

<td class="smalltxt"><a href="viewthread.php?fid=$fid&amp;tid=$tid&amp;action=printable">$lang[textprintver]</a> | <a href="memcp.php?action=subscriptions&amp;subadd=$tid">$lang[textsubscribe]</a> | <a href="memcp.php?action=favorites&amp;favadd=$tid">$lang[textaddfav]</a></td>

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

<td class="smalltxt">$nonmemthreadopts$memthreadopts</td>

============================================================================================================================
=======
Step 6:
=======

Upload the provided images named "print.gif", "subscribe.gif", and "favorites.gif" to all of your theme folders.

============================================================================================================================
Enjoy!