============================================================================================================================
Modification Title: Mood Icons

Version: 1.0

Author: John Briggs

Description:
This modification provides an option to select from 33 mood icon images on member registration form.
This modification provides an option to select from 33 mood icon images in your member control panel.
This modification provides an option to select from 33 mood icon images in the admin editprofile feature regarding user accounts if ever it is needed.
This modification provides an option to see your own mood icon in your member control panel home page.
This modification provides an option to view member's mood icons in threads.
This modification provides an option to view member's mood icons in member profiles.
This modification provides an option in the admin panel that is seperate from regular smilies for control which smilie icons you prefer to use.
This modification provides a separate folder for the 33 mood icon images.

Copyright:  2010 John Briggs. All Rights Reserved.

Compatability: XMB 1.9.5 SP1

Install 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:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================

Upload provided file named "SQL.txt" and Submit Changes.

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

// Mood Icons Mod Begin
$lang['moodiconalt'] = "Mood Icon";
$lang['moodicon'] = "Mood Icons:";
$lang['moodicon2'] = "Mood Icon:";
$lang['moodiconnew'] = "New Mood Icon:";
$lang['moodiconexists'] = "Mood Icon already exists";
$lang['moodiconnone'] = "None";
$lang['moodicons'] = "Mood Icons";
$lang['moodiconsupdate'] = "Mood Icons Updated Successfully.";
// Mood Icons Mod End

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

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

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

    <!-- Mood Icons Mod Begin -->
    &raquo;&nbsp;<a href="cp2.php?action=moodicons"><?php echo $lang['moodicons']?></a><br />
    <!-- Mood Icons Mod End -->

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

} elseif ($action == "censor") {

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

// Mood Icons Mod Begin
} elseif ($action == 'moodicons') {
    if (!isset($_POST['moodiconsubmit'])) {
        ?>
        <tr bgcolor="<?php echo $altbg2?>">
        <td align="center">
        <form method="post" action="cp2.php?action=moodicons">
        <table cellspacing="0" cellpadding="0" border="0" width="500" align="center">
        <tr>
        <td bgcolor="<?php echo $bordercolor?>">
        <table border="0" cellspacing="<?php echo $borderwidth?>" cellpadding="<?php echo $tablespace?>" width="100%">
        <tr>
        <td colspan="3" class="category"><font color="<?php echo $cattext?>"><strong><?php echo $lang['moodicon']?></strong></font></td>
        </tr>
        <tr class="header">
        <td align="center"><?php echo $lang['textdeleteques']?></td>
        <td><?php echo $lang['textsmiliefile']?></td>
        <td align="center"><?php echo $lang['moodicon']?></td>
        </tr>
        <?php
        $query = $db->query("SELECT * FROM $table_smilies WHERE type = 'moodicon' ORDER BY id");
        while ($smilie = $db->fetch_array($query)) {
            ?>
            <tr>
            <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow"><input type="checkbox" name="pidelete[<?php echo $smilie['id']?>]" value="1" /></td>
            <td bgcolor="<?php echo $altbg2?>" class="tablerow"><input type="text" name="smoodcode[<?php echo $smilie['id']?>]" value="<?php echo $smilie[url]?>" /></td>
            <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow"><img src="<?php echo ROOT?>images/moodicons/<?php echo $smilie['url']?>" alt="<?php echo $smilie['url']?>" title="<?php echo $smilie['url']?>" /></td>
            </tr>
            <?php
        }
        $db->free_result($query);
        ?>
        <tr bgcolor="<?php echo $altbg1?>" class="tablerow">
        <td><?php echo $lang['moodiconnew']?></td>
        <td colspan="2"><input type="text" name="newurl3" value="" /></td>
        </tr>
        <tr>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>" colspan="3"><input type="submit" class="submit" name="moodiconsubmit" value="<?php echo $lang['textsubmitchanges']?>" /></td>
        </tr>
        </table>
        </td>
        </tr>
        </table>
        </form>
        </td>
        </tr>
        <?php
    }

    if (isset($_POST['moodiconsubmit'])) {
        if (is_array($smoodcode)) foreach ($smoodcode as $key => $val) {
            if (count(array_keys($smoodcode, $val)) > 1) {
                error($lang['moodiconexists'], false, '</td></tr></table></td></tr></table><br />');
            }
        }
        $qmicon = $db->query("SELECT id FROM $table_smilies WHERE type = 'moodicon'");
        while($picon = $db->fetch_array($qmicon)) {
            $id = $picon['id'];
            if (isset($pidelete[$id]) && $pidelete[$id] == 1) {
                $query = $db->query("DELETE FROM $table_smilies WHERE id = '$picon[id]'");
                continue;
            }
            $query = $db->query("UPDATE $table_smilies SET url = '$smoodcode[$id]' WHERE id = '$picon[id]' AND type = 'moodicon'");
        }
        $db->free_result($qmicon);

        if (isset($newurl3) && $newurl3 != '') {
            if ($db->result($db->query("SELECT count(id) FROM $table_smilies WHERE url = '$newurl3' AND type = 'moodicon'"), 0) > 0) {
                error($lang['moodiconexists'], false, '</td></tr></table></td></tr></table><br />');
            }
            $query = $db->query("INSERT INTO $table_smilies (type, code, url, id) VALUES ('moodicon', '', '$newurl3', '')");
        }
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['moodiconsupdate'].'</td></tr>';
        redirect('cp2.php?action=moodicons', 2.5, X_REDIRECT_JS);
    }
    // Mood Icons Mod End

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

    eval('echo stripslashes("'.template('admintool_editprofile').'");');

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

    // Mood Icons Mod Begin
    $listed_moodicons = 0;
    $moodicons = '<input type="radio" name="posticon" value="" checked="checked" />&nbsp;'.$lang['moodiconnone'].'<br />';
    $querysmilie = $db->query("SELECT * FROM $table_smilies WHERE type = 'moodicon'");
    while ($smilie = $db->fetch_array($querysmilie)) {
        if ($member['moodicon'] == $smilie['url']) {
            $moodicons .= '<input type="radio" name="posticon" value="'.$smilie['url'].'" checked="checked" />&nbsp;<img src="'.ROOT.'images/moodicons/'.$smilie['url'].'" alt="'.$smilie['code'].'" title="'.$smilie['code'].'" border="0" />';
        } else {
            $moodicons .= '<input type="radio" name="posticon" value="'.$smilie['url'].'" />&nbsp;<img src="'.ROOT.'images/moodicons/'.$smilie['url'].'" alt="'.$smilie['code'].'" title="'.$smilie['code'].'" border="0" />';
        }
        $listed_moodicons += 1;
        if ($listed_moodicons == 10) {
            $moodicons .= '<br />';
            $listed_moodicons = 0;
        }
    }
    $db->free_result($querysmilie);
    // Mood Icons Mod End

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

    $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

    // Mood Icons Mod Begin
    $posticon = htmlspecialchars($posticon);
    // Mood Icons Mod End

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

$db->query("UPDATE $table_members

==============================
Find Code At End Of Above Statement:
==============================

 WHERE username='$user'");

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

, moodicon='$posticon' WHERE username='$user'");

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

        eval('echo stripslashes("'.template('memcp_profile').'");');

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

        // Mood Icons Mod Begin
        $listed_moodicons = 0;
        $moodicons = '<input type="radio" name="posticon" value="" checked="checked" />&nbsp;'.$lang['moodiconnone'].'<br />';
        $querysmilie = $db->query("SELECT * FROM $table_smilies WHERE type = 'moodicon'");
        while ($smilie = $db->fetch_array($querysmilie)) {
            if ($member['moodicon'] == $smilie['url']) {
                $moodicons .= '<input type="radio" name="posticon" value="'.$smilie['url'].'" checked="checked" />&nbsp;<img src="'.ROOT.'images/moodicons/'.$smilie['url'].'" alt="'.$smilie['code'].'" title="'.$smilie['code'].'" border="0" />';
            } else {
                $moodicons .= '<input type="radio" name="posticon" value="'.$smilie['url'].'" />&nbsp;<img src="'.ROOT.'images/moodicons/'.$smilie['url'].'" alt="'.$smilie['code'].'" title="'.$smilie['code'].'" border="0" />';
            }
            $listed_moodicons += 1;
            if ($listed_moodicons == 10) {
                $moodicons .= '<br />';
                $listed_moodicons = 0;
            }
        }
        $db->free_result($querysmilie);
        // Mood Icons Mod End

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

        $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

        // Mood Icons Mod Begin
        $posticon = htmlspecialchars($posticon);
        // Mood Icons Mod End

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

$db->query("UPDATE $table_members SET $pwtxt

==============================
Find Code At End Of Above Statement:
==============================

 WHERE username='$xmbuser'");

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

, moodicon='$posticon' WHERE username='$xmbuser'");

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

    if ($member['mood'] != '') {
        $member['mood'] = censor($member['mood']);
        $member['mood'] = postify($member['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
    } else {
        $member['mood'] = '';
    }

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

    // Mood Icons Mod Begin
    $moodicons = '';
    if ($member['moodicon'] != '') {
        $moodicons = '<img src="'.ROOT.'images/moodicons/'.$member['moodicon'].'" alt="'.$lang['moodiconalt'].'" title="'.$lang['moodiconalt'].'" border="0" />';
    }
    // Mood Icons Mod End

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

loadtemplates(

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

loadtemplates(
'member_profile_moodicons',

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

            if ($memberinfo['mood'] != '') {
                $memberinfo['mood'] = censor($memberinfo['mood']);
                $memberinfo['mood'] = postify($memberinfo['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
            } else {
                $memberinfo['mood'] = '';
            }

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

            // Mood Icons Mod Begin
            $moodicons = '';
            $moodiconsblock = '';
            if ($memberinfo['moodicon'] != '') {
                $moodicons = '<img src="'.ROOT.'images/moodicons/'.$memberinfo['moodicon'].'" alt="'.$lang['moodiconalt'].'" title="'.$lang['moodiconalt'].'" border="0" />';
                eval('$moodiconsblock = "'.template('member_profile_moodicons').'";');
            }
            // Mood Icons Mod End

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

            eval('echo stripslashes("'.template('member_reg').'");');

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

            // Mood Icons Mod Begin
            $listed_moodicons = 0;
            $moodicons = '<input type="radio" name="posticon" value="" checked="checked" />&nbsp;'.$lang['moodiconnone'].'<br />';
            $querysmilie = $db->query("SELECT * FROM $table_smilies WHERE type='moodicon'");
            while ($smilie = $db->fetch_array($querysmilie)) {
                $moodicons .= '<input type="radio" name="posticon" value="'.$smilie['url'].'" />&nbsp;<img src="'.ROOT.'images/moodicons/'.$smilie['url'].'" alt="'.$smilie['code'].'" title="'.$smilie['code'].'" />';
                $listed_moodicons += 1;
                if ($listed_moodicons == 10) {
                    $moodicons .= '<br />';
                    $listed_moodicons = 0;
                }
            }
            $db->free_result($querysmilie);
            // Mood Icons Mod End

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

        $sig           = isset($sig) ? checkInput($sig, '', $SETTINGS['sightml'], '', false) : '';

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

        // Mood Icons Mod Begin
        $posticon = htmlspecialchars($posticon);
        // Mood Icons Mod End

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

        $db->query("INSERT INTO $table_members (uid,

=============================
Find Code In-Line In Above Statement:
=============================

) VALUES ('', '$username',

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

, moodicon) VALUES ('', '$username',

==================================
Find Code At End Of Above Query Statement:
==================================

)");

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

, '$posticon')");

============================================================================================================================
=======
Step 8:
=======
=========================
Edit File: viewthread.php
=========================

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

            if ($post['mood'] != '') {
                $post['mood'] = censor($post['mood']);
                $mood = '<strong>'.$lang['mood'].'</strong> '.postify($post['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
            } else {
                $mood = '';
            }

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

            // Mood Icons Mod Begin
            $moodicons = '';
            if ($post['moodicon'] != '') {
                $moodicons = '<br /><br /><strong>'.$lang['moodicon2'].'</strong>&nbsp;<img src="'.ROOT.'images/moodicons/'.$post['moodicon'].'" alt="'.$lang['moodiconalt'].'" title="'.$lang['moodiconalt'].'" border="0" />';
            }
            // Mood Icons Mod End

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

            $location = '';
            $mood = '';

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

            // Mood Icons Mod Begin
            $moodicons = '';
            // Mood Icons Mod End

============================================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[userprofilemood]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="newmood" size="25" value="$member[mood]" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%" valign="top">$lang[moodicon]</td>
<td bgcolor="$altbg2">$moodicons</td>
</tr>

============================================================================================================================
========
Step 10:
========
===============================
Go To Administration Panel --> Templates
===============================
======================
Edit Template: memcp_home
======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">$lang[moodicon2]</td>
<td bgcolor="$altbg2" valign="top">$moodicons</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
</tr>

============================================================================================================================
========
Step 11:
========
===============================
Go To Administration Panel --> Templates
===============================
======================
Edit Template: memcp_profile
======================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[memcpmood]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="newmood" size="25" value="$member[mood]" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%" valign="top">$lang[moodicon]</td>
<td bgcolor="$altbg2">$moodicons</td>
</tr>

=======================================================================================================================================
========
Step 12:
========
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" valign="top" class="tablerow">$lang[userprofilemood]</td>
<td bgcolor="$altbg2" class="tablerow">$memberinfo[mood]</td>
</tr>

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

$moodiconsblock

============================================================================================================================
========
Step 13:
========
===============================
Go To Administration Panel --> Templates
===============================
========================
Edit Template: viewthread_post
========================
Find Code:
==========

$mood

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

$moodicons

============================================================================================================================
========
Step 14:
========
===============================
Go To Administration Panel --> Templates
===============================
=====================
Edit Template: member_reg
=====================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[memcpmood]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="mood" size="25" value="" value="" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%" valign="top">$lang[moodicon]</td>
<td bgcolor="$altbg2">$moodicons</td>
</tr>

============================================================================================================================
========
Step 15:
========
===============================
Go To Administration Panel --> Templates
===============================
=====================================
Create New Template: member_profile_moodicons
=====================================
========================
Add Code and Submit Changes:
========================

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[moodicon2]</td>
<td bgcolor="$altbg2">$moodicons</td>
</tr>

============================================================================================================================
========
Step 16:
========

Upload provided folder "moodicons" to your forum "images" directory.

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