Title: Member Control Panel Quick Theme Selection v1.0

Author: John Briggs

Description:
This mod will provide a drop down selection in your control panel to select available themes on your forum.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

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 XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

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

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

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

loadtemplates(

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

loadtemplates('memcp_home_themes',

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

// Determine if user is logged in, if not send to login page
if ( X_GUEST ) {
    redirect('misc.php?action=login', 0);
    exit();
}

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

$newtheme = (isset($newtheme) && is_numeric($newtheme)) ? (int) $newtheme : 0;
if ($action == 'quicktheme') {
    $db->query("UPDATE $table_members SET theme='$newtheme' WHERE username='$xmbuser'");
    redirect('memcp.php', 0);
}

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

    // Load Buddy List
    $q = $db->query("SELECT b.buddyname, w.invisible, w.username FROM $table_buddys b LEFT JOIN $table_whosonline w ON (b.buddyname=w.username) WHERE b.username='$xmbuser'");
    $buddys = array();
    $buddys['offline'] = '';
    $buddys['online'] = '';
    if (X_ADMIN) {
        while ($buddy = $db->fetch_array($q)) {
            if (strlen($buddy['username']) > 0) {
                if ($buddy['invisible'] == 1) {
                   $buddystatus = $lang['hidden'];
                } else {
                    $buddystatus = $lang['textonline'];
                }
                eval("\$buddys['online'] .= \"".template("buddylist_buddy_online")."\";");
            } else {
                eval("\$buddys['offline'] .= \"".template("buddylist_buddy_offline")."\";");
            }
        }
    } else {
        while ($buddy = $db->fetch_array($q)) {
            if (strlen($buddy['username']) > 0) {
                if ($buddy['invisible'] == 1) {
                   eval("\$buddys[offline] .= \"".template("buddylist_buddy_offline")."\";");
                   continue;
                } else {
                    $buddystatus = $lang['textonline'];
                }
                eval("\$buddys['online'] .= \"".template("buddylist_buddy_online")."\";");
            } else {
                eval("\$buddys['offline'] .= \"".template("buddylist_buddy_offline")."\";");
            }
        }
    }

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

    $listquickthemes = array();
    $query = $db->query("SELECT themeid, name FROM $table_themes ORDER BY name ASC");
    $quickthemes = '';
    while ($qt = $db->fetch_array($query)) {
        if ($self['theme'] == $qt['themeid']) {
            $listquickthemes[] = '<option value="'.$qt['themeid'].'" selected="selected">'.stripslashes($qt['name']).'</option>';
        } else {
            $listquickthemes[] = '<option value="'.$qt['themeid'].'">'.stripslashes($qt['name']).'</option>';
        }
    }
    $listquickthemes[] = '</select>';
    $listquickthemes = implode("\n", $listquickthemes);
    $db->free_result($query);
    eval("\$quickthemes .= \"".template("memcp_home_themes")."\";");

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

============================================
Go To Admin Panel -> Templates -> memcp_home
============================================

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

$THEME[name]

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

$quickthemes

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

===========================================================================
Go To Admin Panel -> Templates -> Create Template Name -> memcp_home_themes
===========================================================================

================================
Add Code & Click Submit Changes:
================================

<form method="get" action="memcp.php?action=quicktheme">
<select name="action" id="action" onchange="if(this.options[this.selectedIndex].value != '') { window.location=('memcp.php?action=quicktheme&amp;newtheme='+this.options[this.selectedIndex].value) }">
$listquickthemes
</select>
</form>

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