Modification Name: Theme Preview


Description: This modification will give your members the option to 'preview' Themes and set them as theirs within a second.
                   After you upload some screenshots the Themes will be displayed in their own table using the colors of that theme.
                   If turned on, the amount of members that use each Theme will be displayed.
                   If turned on, the Staff can create Categories and assign Themes to Categories. This will also be displayed in the Theme Preview.

Version: 3.3

Compatibility: XMB 1.9.8 SP3/SP4

Code Designed By: FunForum
Updated for 1.9.8 by: WormHole @ XMB Garage

License Note: This modification is released under the GPL License. A copy is provided with this software package.
                      Give credit where credit is due.

Warning: Always backup the stuff you are going to modify when installing a modification, before you install!

Notes: 
 - 2004 / 09 / 26; Adjusted the coding. Activated DEBUG mode and worked out all "issues".

 - 2004 / 12 / 30; Added a so called "Dead Image support". If no screenshot has been uploaded for a theme, a standard image will be displayed.

 - 2006 / 03 / 07; - Redid A LOT. Now 1.9.5 compatible.
                   - Added the option to use bigger screenshots in, for example, this URL: themes.php?id=1
                   - Improved the "Dead Image support", the old version was rather messy.
                   - Moved settings into Settings DB table. Saw someone who made a clean file out of this modification and moved settings into the database, liked the idea.

 - 2006 / 10 / 10; - XMB 1.9.6 instructions.
                   - Moved part of the instructions into a TXT file.
 - 2006 / 10 / 31; - Added Categories.
                   - Added Theme counters.
 - 2006 / 11 / 14; - Adjusted 1 query used during installation.
                   - Added links to order the Themes by Name, ID and Asc, Desc. It was already possible, but users didn't know.
 - 2007 / 01 / 06; - Staff can add an author to a Theme in the Admin Panel.
                   - There's an admin option in the Admin Panel to disable the theme counters.
                   - Counters will also show in member profiles.
 - 2008 / 01 / 17; - Updated for 1.9.8 by WormHole @ XMB Garage.



============================================================================================================================
+  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +
             Installation instructions, part 1
+  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +
============================================================================================================================
=======
Step 1.
=======

In order for this modification to work, you're going to need the "sanitize.inc.php". This can be achieved in two ways. 

 - Upload sanitize.inc.php, found in the Contents folder, to your forum's include folder.

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

// Theme Preview Mod Begin
$lang['themepreview_01'] = "Theme Preview";
$lang['themepreview_02'] = "Theme Preview Administrator Controls";
$lang['themepreview_03'] = "Theme Preview Status:";
$lang['themepreview_04'] = "This feature is not enabled.";
$lang['themepreview_05'] = "Guests can view Theme Preview:";
$lang['themepreview_06'] = "Guests are not allowed to use this feature.";
$lang['themepreview_07'] = "This link will become available once you are loggedin.";
$lang['themepreview_08'] = "Amount of themes per page:";
$lang['themepreview_09'] = "The Default Theme on this board is";
$lang['themepreview_10'] = "Set this theme as my theme.";
$lang['themepreview_11'] = "Previewing Themes";
$lang['themepreview_12'] = "This theme does not exist.";
$lang['themepreview_13'] = "Theme Preview Extention:";
$lang['themepreview_14'] = "Do you want bigger screenshots being displayed in URLs like these? theme.php?id=2";
$lang['themepreview_15'] = "Click here to see a bigger screenshot of this theme.";
$lang['themepreview_16'] = "On page 1, display the Default Theme at the top:";
$lang['themepreview_17'] = 'View All Categories';
$lang['themepreview_18'] = "This theme is in the Category";
$lang['themepreview_19'] = "This theme is being used by *count* members.";
$lang['themepreview_20'] = "Theme Category:";
$lang['themepreview_21'] = "Theme Categories";
$lang['themepreview_22'] = "Theme Categories, Add New Categories";
$lang['themepreview_23'] = "Theme Categories, Edit Categories";
$lang['themepreview_24'] = "Category Status:";
$lang['themepreview_25'] = "Display the amount of members that use a theme:";
$lang['themepreview_26'] = "Recount usage of themes every ?? hours:";
$lang['themepreview_27'] = "Click *here* to (force) recount the amount of people that use what theme.";
$lang['themepreview_28'] = "Name";
$lang['themepreview_29'] = "ID";
$lang['themepreview_30'] = "Display the Authors of Themes?";
$lang['themepreview_31'] = "Theme Author:";
$lang['themepreview_32'] = "This theme has been created by *author*.";
$lang['themepreview_33'] = "<em>deleted member</em>";
$lang['themepreview_34'] = "Select an author";
$lang['themepreview_35'] = "Themes created:";
// Theme Preview Mod End

============================================================================================================================
=======
Step 3.
=======
========================
Edit File: /include/online.inc.php
========================
==========
Find Code: 
==========

    } else if (false !== strpos($url, '/topicadmin.php')) {
        $location = $lang['onlinetopicadmin'];

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

    // Theme Preview Mod Begin
    } elseif (false !== strpos($url, "/themes.php")) {
        $location = $lang['themepreview_11'];
    // Theme Preview Mod End

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

$othertid = '';

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

// Theme Preview Mod Begin
$themepreviewstatus = '';
// Theme Preview Mod End

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

require ROOT.'include/validate.inc.php';

====================================
Add Below (if it isn't already in your header.php):
====================================

require ROOT.'include/sanitize.inc.php';

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

$links = implode(' &nbsp; ', $links);

===============
Add Code Above:
===============

// Theme Preview Mod Begin
if ( $SETTINGS['themepreviewstatus'] == 'on' ) {
    $links[] = '<img src="'.$THEME['imgdir'].'/top_themes.gif" alt="'.$lang['themepreview_01'].'" border="0" /> <a href="themes.php"><font class="navtd">'.$lang['themepreview_01'].'</font></a>';
}
// Theme Preview Mod End

============================================================================================================================
=======
Step 5.
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

        $onlinetoday_statuson = $onlinetoday_statusoff = '';
        settingHTML('onlinetoday_status', $onlinetoday_statuson, $onlinetoday_statusoff);

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

        // Theme Preview Mod Begin
        $tpstatuson = $tpstatusoff = '';
        settingHTML('themepreviewstatus', $tpstatuson, $tpstatusoff);
        
        $tpguestson = $tpguestsoff = '';
        settingHTML('themepreviewguests', $tpguestson, $tpguestsoff);
        // Theme Preview Mod End

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

        $allowipreg[0] = $allowipreg[1] = false;
        if ($SETTINGS['ipreg'] == 'on') {
            $allowipreg[0] = true;
        } else {
            $allowipreg[1] = true;
        }

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

        // Theme Preview Mod Begin
        $tpextgif = $tpextjpg = $tpextpng = false;
        switch($SETTINGS['themepreviewext']) {
            case 'gif':
                $tpextgif = true;
                break;
            case 'jpg':
                $tpextjpg = true;
                break;
            case 'png':
                $tpextpng = true;
                break;
        }
        
        $tpbigon = $tpbigoff = '';
        settingHTML('themepreviewbig', $tpbigon, $tpbigoff);
        
        $tpshowmainon = $tpshowmainoff = '';
        settingHTML('themepreviewsm', $tpshowmainon, $tpshowmainoff);

        $tpcatson = $tpcatsoff = '';
        settingHTML('themepreviewcats', $tpcatson, $tpcatsoff);

        $tpmcon = $tpmcoff = '';
        settingHTML('themepreviewmc', $tpmcon, $tpmcoff);

        $tpAuthoron = $tpAuthoroff = '';
        settingHTML('themepreviewauthor', $tpAuthoron, $tpAuthoroff);

        $themepreviewut = $SETTINGS['themepreviewut'] / 3600;
        // Theme Preview Mod End

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

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg2?>" colspan="2">&nbsp;</td>
        </tr>
        <tr class="category">
        <td colspan="2"><strong><font color="<?php echo $cattext?>">&raquo;&nbsp;<?php echo $lang['admin_main_settings6']?></font></strong></td>
        </tr>

===============
Add Code Above: 
===============

        <!-- Theme Preview Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $THEME['altbg2']?>" colspan="2">&nbsp;</td>
        </tr>
        <tr class="category">
        <td colspan="2"><strong><font color="<?php echo $THEME['cattext']?>">&raquo;&nbsp;<?php echo $lang['themepreview_02']?></font></strong></td>
        </tr>
        <?php
        printsetting1($lang['themepreview_03'], 'TPstatus_new', $tpstatuson, $tpstatusoff);
        printsetting1($lang['themepreview_05'], 'TPguests_new', $tpguestson, $tpguestsoff);
        printsetting2($lang['themepreview_08'], 'TPpp_new', $SETTINGS['themepreviewpp'], 4);
        printsetting1($lang['themepreview_30'], 'TPauthor_new', $tpAuthoron, $tpAuthoroff);
        printsetting1($lang['themepreview_14'], 'TPbig_new', $tpbigon, $tpbigoff);
        printsetting3($lang['themepreview_13'], 'TPext_new', array('GIF', 'JPG', 'PNG'), array('gif', 'jpg', 'png'), array($tpextgif, $tpextjpg, $tpextpng), false);
        printsetting1($lang['themepreview_16'], 'TPshowmain_new', $tpshowmainon, $tpshowmainoff);
        printsetting1($lang['themepreview_24'], 'TPcats_new', $tpcatson, $tpcatsoff);
        printsetting1($lang['themepreview_25'], 'TPmc_new', $tpmcon, $tpmcoff);
        printsetting2($lang['themepreview_26'], 'TPut_new', $themepreviewut, 4);
        echo ($SETTINGS['themepreviewmc'] == 'off' ? '' : '<tr><td class="tablerow" bgcolor="'.$THEME['altbg2'].'" colspan="2"><a href="themes.php?action=forcerecount" target="_blank">'.$lang['themepreview_27'].'</a></td></tr>');
        ?>
        <!-- Theme Preview Mod End -->

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

        $onlinetoday_statusnew = formOnOff('onlinetoday_statusnew');

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

        // Theme Preview Mod Begin
        $TPstatus_new = formOnOff('TPstatus_new');
        $TPguests_new = formOnOff('TPguests_new');
        $TPshowmain_new = formOnOff('TPshowmain_new');
        $TPbig_new = formOnOff('TPbig_new');
        $TPcats_new = formOnOff('TPcats_new', X_POST);
        $TPmc_new = formOnOff('TPmc_new', X_POST);
        $TPauthor_new = formOnOff('TPauthor_new', X_POST);
        $TPut_new = safeInt(formInt('TPut_new', X_POST), 0);
        $TPut_new = ($TPut_new == 0 ? 86400 : ($TPut_new * 3600));
        $TPpp_new = safeInt(formInt('TPpp_new', X_POST), 5);
        $TPpp_new = ($TPpp_new == 0 ? 10 : $TPpp_new);
        $TPext_new = formOnOff('TPext_n', X_POST);
        $TPext_new = (!in_array($TPext_new, array('gif', 'jpg', 'png')) ? 'jpg' : $TPext_new);
        // Theme Preview Mod End

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

        $db->query("UPDATE ".X_PREFIX."settings SET

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

        $db->query("UPDATE ".X_PREFIX."settings SET
            themepreviewstatus='$TPstatus_new',
            themepreviewguests='$TPguests_new',
            themepreviewpp='$TPpp_new',
            themepreviewext='$TPext_new',
            themepreviewsm='$TPshowmain_new',
            themepreviewbig='$TPbig_new',
            themepreviewcats='$TPcats_new',
            themepreviewmc='$TPmc_new',
            themepreviewut='$TPut_new',
            themepreviewauthor='$TPauthor_new',

====================
Find Code At End Of File: 
====================

echo '</table></td></tr></table>';
end_time();
eval('echo "'.template('footer').'";');
?>

===============
Add Code Above:
===============

// Theme Preview Mod Begin
if ($action == 'themecats') {
    echo '</table></td></tr></table><br />';

    $tcsubmit = fetchFromRequest('tcsubmit', X_POST);
    $memnum = '5';

    if (is_null($tcsubmit)) {
        echo '<form method="post" action="cp.php?action=themecats">
        <table cellspacing="0" cellpadding="0" border="0" width="'.$THEME['tablewidth'].'" align="center"><tr><td bgcolor="'.$THEME['bordercolor'].'"><table border="0" cellspacing="'.$THEME['borderwidth'].'" cellpadding="'.$THEME['tablespace'].'" width="100%">
        <tr><td class="category" colspan="3" align="left"><font color="'.$THEME['cattext'].'"><strong>'.$lang['themepreview_22'].'</strong></font></td></tr>';

        for ($Fi = 0; $Fi < $memnum; $Fi++) {
        echo '<tr class="tablerow" bgcolor="'.$THEME['altbg2'].'">
            <td width="100">New Category:</td>
            <td colspan="2"><input type="text" name="newcode'.$Fi.'" value="" size="50" /></td>
            </tr>';
        }
        echo '<tr><td class="ctrtablerow" bgcolor="'.$THEME['altbg1'].'" colspan="3"><input type="submit" class="submit" name="tcsubmit" value="'.$lang['textsubmitchanges'].'" /></td></tr>
        '.($SETTINGS['themepreviewmc'] == 'off' ? '' : '<tr><td class="tablerow" bgcolor="'.$THEME['altbg2'].'" colspan="3"><a href="themes.php?action=forcerecount" target="_blank">'.$lang['themepreview_27'].'</a></td></tr>').'

        <tr>
        <td class="category" colspan="3" align="left"><font color="'.$THEME['cattext'].'"><strong>'.$lang['themepreview_23'].'</strong></font></td>
        </tr>

        <tr class="header">
        <td width="50"> # </td>
        <td width="50" align="center">'.$lang['textdeleteques'].'</td>
        <td> </td>
        </tr>';

        $query = $db->query("SELECT * FROM ".X_PREFIX."themecats ORDER BY cname ASC");
        while ($TC = $db->fetch_array($query)) {
            echo '<tr>
            <td class="ctrtablerow" bgcolor="'.$THEME['altbg2'].'">'.$TC['cid'].'</td>
            <td class="ctrtablerow" bgcolor="'.$THEME['altbg2'].'"><input type="checkbox" name="smdelete['.$TC['cid'].']" value="1" /></td>
            <td class="tablerow" bgcolor="'.$THEME['altbg2'].'"><input type="text" name="smcode['.$TC['cid'].']" value="'.stripslashes($TC['cname']).'" size="50" /></td>
            </tr>';
        }

        $db->free_result($query);

        echo '<tr><td class="ctrtablerow" bgcolor="$THEME[altbg1]" colspan="3"><input type="submit" class="submit" name="tcsubmit" value="'.$lang['textsubmitchanges'].'" /></td></tr>

        </table> </td></tr></table> </form>';

    }
    if (!is_null($tcsubmit)) {
        $query = $db->query("SELECT * FROM ".X_PREFIX."themecats");
        while ($TC = $db->fetch_array($query)) {
            $cid = $TC['cid'];

            $name = safeAddslashes($smcode[$cid]);
            $db->query("UPDATE ".X_PREFIX."themecats SET cname = '$name' WHERE cid = '$TC[cid]'");

            if ( isset($smdelete[$cid]) && $smdelete[$cid] == 1 && $cid <> 1 ) {
                $db->query("UPDATE ".X_PREFIX."themes SET themecat='1' WHERE themecat = '$cid'");
                $db->query("DELETE FROM ".X_PREFIX."themecats WHERE cid = '$cid'");
                continue;
            }
        }
        $db->free_result($query);

        for ($Fi = 0; $Fi < $memnum; $Fi++) {
            $newcode = "newcode$Fi";
            $newcode = "${$newcode}";

            if ( isset($newcode) && !empty($newcode) ) {
                $name = safeAddslashes($newcode);
                if ($db->result($db->query("SELECT count(cid) FROM ".X_PREFIX."themecats WHERE cname = '$name'"), 0) == 0) {
                    $db->query("INSERT INTO ".X_PREFIX."themecats (cname) VALUES ('$name')");
                }
            }
        }
        redirect('cp.php?action=themecats', 0, X_REDIRECT_JS);
    }

    end_time();
    eval('echo "'.template('footer').'";');
    exit;
}
// Theme Preview Mod End

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

                $db->query("DELETE FROM ".X_PREFIX."themes WHERE themeid='$themeid'");

===============
Add Code Above:
===============

                // Theme Preview Mod Begin
                $query = $db->query("SELECT author, themecat FROM ".X_PREFIX."themes WHERE themeid = '$themeid'");
                $themeinfo = $db->fetch_array($query);
                $db->query("UPDATE ".X_PREFIX."themecats SET ccount=ccount-1 WHERE cid='$themeinfo[themecat]'");
                $db->query("UPDATE ".X_PREFIX."members SET themecount=themecount-1 WHERE uid='$themeinfo[author]'");
                // Theme Preview Mod Begin

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

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

----------------------------------------
Replace With:
----------------------------------------

        $themestuff = $db->fetch_array($query);
        // Theme Preview Mod Begin
        $themecatbox = '<select name="themecatnew">';
        $query = $db->query("SELECT * FROM ".X_PREFIX."themecats ORDER BY cname ASC");
        while($themeinfo = $db->fetch_array($query)) {
            $selected = ($themeinfo['cid'] == $themestuff['themecat']) ? ' selected="selected"' : '';
            $themecatbox .= '<option value="'.$themeinfo['cid'].'"'.$selected.'>'.stripslashes($themeinfo['cname']).'</option>';
        }
        $db->free_result($query);
        $themecatbox .= "</select>";

        $authorbox = '<select name="authornew"> <option value="0">'.$lang['themepreview_34'].'</option>';
        $query = $db->query("SELECT uid, username FROM ".X_PREFIX."members ORDER BY username ASC");
        while($M = $db->fetch_array($query)) {
            $selected = ($M['uid'] == $themestuff['author']) ? ' selected="selected"' : '';
            $authorbox .= '<option value="'.$M['uid'].'"'.$selected.'>'.$M['username'].'</option>';
        }
        $db->free_result($query);
        $authorbox .= "</select>";
        // Theme Preview 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 Preview Mod Begin -->
        <tr bgcolor="<?php echo $THEME['altbg2']?>" class="tablerow">
        <td><?php echo $lang['themepreview_20']; ?> <input type="hidden" name="themecatold" value="<?php echo $themestuff['themecat']; ?>" /></td>
        <td colspan="2"><?php echo $themecatbox; ?></td>
        </tr>
        <tr bgcolor="<?php echo $THEME['altbg2']?>" class="tablerow">
        <td><?php echo $lang['themepreview_31']; ?> <input type="hidden" name="authorold" value="<?php echo $themestuff['author']; ?>" /></td>
        <td colspan="2"><?php echo $authorbox; ?></td>
        </tr>
        <!-- Theme Preview Mod End -->

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

    } else if ($single_str == "anewtheme1") {

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

        // Theme Preview Mod Begin
        $themecatbox = '<select name="themecatnew">';
        $query = $db->query("SELECT * FROM ".X_PREFIX."themecats ORDER BY cname ASC");
        while($themeinfo = $db->fetch_array($query)) {
            $themecatbox .= '<option value="'.$themeinfo['cid'].'">'.stripslashes($themeinfo['cname']).'</option>';
        }
        $db->free_result($query);
        $themecatbox .= "</select>";

        $authorbox = '<select name="authornew"> <option value="0">'.$lang['themepreview_34'].'</option>';
        $query = $db->query("SELECT uid, username FROM ".X_PREFIX."members ORDER BY username ASC");
        while($M = $db->fetch_array($query)) {
            $authorbox .= '<option value="'.$M['uid'].'">'.$M['username'].'</option>';
        }
        $db->free_result($query);
        $authorbox .= "</select>";
        // Theme Preview 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 Preview Mod Begin -->
        <tr bgcolor="<?php echo $THEME['altbg2']?>" class="tablerow">
        <td><?php echo $lang['themepreview_20']; ?> <input type="hidden" name="themecatold" value="0" /></td>
        <td><?php echo $themecatbox; ?></td>
        </tr>
        <tr bgcolor="<?php echo $THEME['altbg2']?>" class="tablerow">
        <td><?php echo $lang['themepreview_31']; ?> <input type="hidden" name="authorold" value="0" /></td>
        <td><?php echo $authorbox; ?></td>
        </tr>
        <!-- Theme Preview Mod End -->

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

        foreach($theme_name as $themeid=>$name) {
            $db->query("UPDATE ".X_PREFIX."themes SET name='$name' WHERE themeid='$themeid'");

----------------------------------------
Replace With:
----------------------------------------

        foreach($theme_name as $themeid=>$name) {
            // Theme Preview Mod Begin
            $themecatnew = safeInt(formInt('themecatnew', X_POST));
            $themecatold = safeInt(formInt('themecatold', X_POST));
            if ($themecatold <> $themecatnew) {
                $db->query("UPDATE ".X_PREFIX."themecats SET ccount=ccount-1 WHERE cid='$themecatold'");
                $db->query("UPDATE ".X_PREFIX."themecats SET ccount=ccount+1 WHERE cid='$themecatnew'");
            }
            $authornew = safeInt(formInt('authornew', X_POST));
            $authorold = safeInt(formInt('authorold', X_POST));
            if ($authornew <> $authorold) {
                $db->query("UPDATE ".X_PREFIX."members SET themecount=themecount-1 WHERE uid='$authorold'");
                $db->query("UPDATE ".X_PREFIX."members SET themecount=themecount+1 WHERE uid='$authornew'");
            }
            // Theme Preview Mod End
            $db->query("UPDATE ".X_PREFIX."themes SET name='$name' WHERE themeid='$themeid'");

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

imgdir='$imgdirnew', smdir='$smdirnew', cattext='$cattextnew'

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

imgdir='$imgdirnew', smdir='$smdirnew', cattext='$cattextnew', themecat='$themecatnew', author='$authornew'

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

imgdir, smdir, cattext

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

imgdir, smdir, cattext, themecat, author

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

'$imgdirnew', '$smdirnew', '$cattextnew'

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

'$imgdirnew', '$smdirnew', '$cattextnew', '$themecatnew', '$authornew'

============================================================================================================================
=======
Step 7.
=======
=======================
Edit File: include/admin.inc.php
=======================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="cp2.php?action=themes"><?php echo $lang['themes']?></a><br />

----------------------------------------
Add Above:
----------------------------------------

    <!-- Theme Preview Mod Begin -->
    &raquo;&nbsp;<a href="cp.php?action=themecats"><?php echo $lang['themepreview_21']?></a><br />
    <!-- Theme Preview Mod End -->

============================================================================================================================
========
Step 8.
========
=================
Edit File: member.php
=================
==========
Find Code:
==========

                $rank['avatarrank'] = trim($rank['avatarrank']);

===============
Add Code Above:
===============

                // Theme Preview Mod Begin
                $ThemeCounter = '';
                if ($SETTINGS['themepreviewauthor'] == 'on') {
                    $tpquery = $db->query("SELECT COUNT(themeid) FROM ".X_PREFIX."themes WHERE author='$memberinfo[uid]'");
                    $ThemeCounter = $db->result($tpquery, 0);
                    $db->free_result($tpquery);
                }
                // Theme Preview Mod End

============================================================================================================================
=======
Step 9.
=======
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textproflastpost]</td>
<td bgcolor="$altbg2">$lastpost</td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" valign="top">$lang[themepreview_35]</td>
<td bgcolor="$THEME[altbg2]">$ThemeCounter</td>
</tr>

============================================================================================================================
+  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +
            Installation instructions, part 2
+  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +

All information you need now can be found in the themes.php file itself. This is accessable by all Super Administrators.
Upload the themes.php to your forum directory and point your browser to the file like this:  http://www.yoursite.com/forum_folder/themes.php?action=help
Or like this if your forum is in the ROOT folder: http://www.yoursite.com/themes.php?action=help

Example: http://www.yourdomain.com/forum/themes.php?action=help

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