Modification Title: Theme Based Thread Options v1.0

Mod Author: John Briggs & John Clawson

Last Updated: 05/13/09

Modification 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.8 SP3

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

License Note: This modification is released under the GPL License. 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 at our web site.

=======================================================================================================================
=======
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:
================

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

=======================================================================================================================
=======
Step 2:
=======
===============
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 bgcolor="<?php echo $THEME['altbg2']?>" class="tablerow">
        <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 bgcolor="<?php echo $altbg2?>"="tablerow">
        <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 (2 Times):
=================

        $namenew = postedVar('namenew');

==========================
Add Code Below (both instances):
==========================

        $threadoptsnew = postedVar('threadoptsnew');

==========
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 3:
=======
===================
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 4:
=======
===============================
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 5:
=======

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

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