Title: Theme Based Theme Status v1.1

Author: John Briggs

Description:
This mod will add the ability to enable/disable themes on a per theme basis. Great when working on themes.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 Engage Final SP2

Updated for 1.9.8 by: WormHole @ XMB Garage

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

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

Author Note:
You downloaded this hack from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.

=======================================================================================================================================================
=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

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

=======================================================================================================================================================
=======
Step 2:
=======

================================
Edit File: lang/English.lang.php
================================

================================
Add Code To End Of File Above ?>
================================

// Theme Based Theme Status Mod Begin
$lang['themestatus'] = "Theme Status:<br /><span class=\"smalltxt\">Disabling this will prevent members from seeing the theme.</span>";
// Theme Based Theme Status Mod End

=======================================================================================================================================
=======
Step 2:
=======

==================
Edit File: cp2.php
==================

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

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

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

        $themestatuson = $themestatusoff = '';
        switch ($themestuff['themestatus']) {
            case 'on':
                $themestatuson = $selHTML;
                break;
            default:
                $themestatusoff = $selHTML;
                break;
        }

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

        <tr class="tablerow" bgcolor="<?php echo $THEME[altbg2]?>">
        <td><?php echo $lang['themestatus']?></td>
        <td colspan="2">
        <select name="themestatusnew">
        <option value="on" <?php echo $themestatuson?>><?php echo $lang['texton']?></option>
        <option value="off" <?php echo $themestatusoff?>><?php echo $lang['textoff']?></option>
        </select>
        </td>
        </tr>

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

        <tr class="tablerow" bgcolor="<?php echo $THEME[altbg2]?>">
        <td><?php echo $lang['themestatus']?></td>
        <td colspan="2">
        <select name="themestatusnew">
        <option value="on"><?php echo $lang['texton']?></option>
        <option value="off"><?php echo $lang['textoff']?></option>
        </select>
        </td>
        </tr>

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

    } else if ($single && $single == "submit" && !$newtheme) {
        $namenew = formVar('namenew');

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

    } else if ($single && $single == "submit" && !$newtheme) {
        $namenew = formVar('namenew');
        $themestatusnew = formVar('themestatusnew');

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

 WHERE themeid='$orig'");

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

, themestatus='$themestatusnew' WHERE themeid='$orig'");
        if (isset($themestatusnew) && $themestatusnew != 'on') {
            $db->query("UPDATE ".X_PREFIX."members SET theme='0' WHERE theme='$orig'");
        }

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

    } else if ($single && $single == "submit" && $newtheme) {
        $namenew = formVar('namenew');
        $themestatusnew = formVar('themestatusnew');

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

) VALUES('$namenew'

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

, themestatus) VALUES('$namenew'


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

)");

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

, '$themestatusnew')");

=======================================================================================================================================
=======
Step 3:
=======

=================
Edit File: cp.php
=================

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

        $themelist = array();
        $themelist[] = '<select name="themenew">';
        $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        while($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $SETTINGS['theme']) {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

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

        $themelist = array();
        $themelist[] = '<select name="themenew">';
        if (X_SADMIN) {
            $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        } else {
            $query = $db->query("SELECT themeid, name, themestatus FROM ".X_PREFIX."themes WHERE themestatus='on' ORDER BY name ASC");
        }
        while ($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $SETTINGS['theme']) {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'" selected="selected">'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

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

        $themelist = array();
        $themelist[] = '<select name="themeforumnew">';
        $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
        $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        while($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $forum['theme']) {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

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

        $themelist = array();
        $themelist[] = '<select name="themeforumnew">';
        $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
        if (X_SADMIN) {
            $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        } else {
            $query = $db->query("SELECT themeid, name, themestatus FROM ".X_PREFIX."themes WHERE themestatus='on' ORDER BY name ASC");
        }
        while ($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $forum['theme']) {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'" selected="selected">'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

=======================================================================================================================================
=======
Step 4:
=======

====================
Edit File: memcp.php
====================

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

        $themelist = array();
        $themelist[] = '<select name="thememem">';
        $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
        $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        while($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $member['theme']) {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

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

        $themelist = array();
        $themelist[] = '<select name="thememem">';
        $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
        if (X_SADMIN) {
            $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
        } else {
            $query = $db->query("SELECT themeid, name, themestatus FROM ".X_PREFIX."themes WHERE themestatus='on' ORDER BY name ASC");
        }
        while ($themeinfo = $db->fetch_array($query)) {
            if ($themeinfo['themeid'] == $member['theme']) {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'" selected="selected">'.stripslashes($themeinfo['name']).'</option>';
            } else {
                $themelist[] = '<option value="'.$themeinfo['themeid'].'">'.stripslashes($themeinfo['name']).'</option>';
            }
        }
        $themelist[] = '</select>';
        $themelist = implode("\n", $themelist);

=======================================================================================================================================
=======
Step 5:
=======

=====================
Edit File: member.php
=====================

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

                $themelist = array();
                $themelist[] = '<select name="thememem">';
                $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
                $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
                while($themeinfo = $db->fetch_array($query)) {
                    $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
                }
                $themelist[] = '</select>';
                $themelist = implode("\n", $themelist);

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

                $themelist = array();
                $themelist[] = '<select name="thememem">';
                $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
                $query = $db->query("SELECT themeid, name, themestatus FROM ".X_PREFIX."themes WHERE themestatus='on' ORDER BY name ASC");
                while ($themeinfo = $db->fetch_array($query)) {
                    $themelist[] = '<option value="'.$themeinfo['themeid'].'">'.stripslashes($themeinfo['name']).'</option>';
                }
                $themelist[] = '</select>';
                $themelist = implode("\n", $themelist);

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

==========================
Edit File: editprofile.php
==========================

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

    $themelist = array();
    $themelist[] = '<select name="thememem">';
    $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
    $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
    while($themeinfo = $db->fetch_array($query)) {
        if ($themeinfo['themeid'] == $member['theme']) {
            $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
        } else {
            $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
        }
    }
    $themelist[] = '</select>';
    $themelist = implode("\n", $themelist);

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

    $themelist = array();
    $themelist[] = '<select name="thememem">';
    $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
    if (X_SADMIN) {
        $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
    } else {
        $query = $db->query("SELECT themeid, name, themestatus FROM ".X_PREFIX."themes WHERE themestatus='on' ORDER BY name ASC");
    }
    while ($themeinfo = $db->fetch_array($query)) {
        if ($themeinfo['themeid'] == $member['theme']) {
            $themelist[] = '<option value="'.$themeinfo['themeid'].'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
        } else {
            $themelist[] = '<option value="'.$themeinfo['themeid'].'">'.stripslashes($themeinfo['name']).'</option>';
        }
    }
    $themelist[] = '</select>';
    $themelist = implode("\n", $themelist);

=======================================================================================================================================