Title: U2U Image 1.0

Author: John Briggs

Description:
This mod will provide an image to diplay in upper right hand of board corner when you receive a new U2U message.
This mod will provide an image to diplay in whosonline that will allow registered members to click and send a U2U.
This mod will provide an image to diplay in whosonline today on index that will allow registered members to click and send a U2U.
This mod will provide an image to diplay in whosonline today that will allow registered members to click and send a U2U.

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: header.php
=====================

=======================================================================================================================
NOTE: There are 2 options below. If you want to only have the U2U image display when you receive a U2U then use the
first bit of code. If you want to have a U2U image show when no messages are available as well as new ones then use
the seconds bit of code.
=======================================================================================================================

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

// if the user is registered, check for new u2u's
    $newu2umsg = '';
    if (X_MEMBER) {
        $query = $db->query("SELECT count(readstatus) FROM $table_u2u WHERE owner='$self[username]' AND folder='Inbox' AND readstatus='no'");
        $newu2unum = $db->result($query, 0);
        if ( $newu2unum > 0) {
            $newu2umsg = "<a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\">$lang[newu2u1] $newu2unum $lang[newu2u2]</a>";
        }
    }

==========================================================================
Replace Code With If You Want Only Image To Show When New U2U Is Received:
==========================================================================

// if the user is registered, check for new u2u's
    $newu2umsg = '';
    $newu2uimg = '';
    if (X_MEMBER) {
        $query = $db->query("SELECT count(readstatus) FROM $table_u2u WHERE owner='$self[username]' AND folder='Inbox' AND readstatus='no'");
        $newu2unum = $db->result($query, 0);
        if ($newu2unum > 0) {
            $newu2uimg = "<img src=\"$imgdir/u2u_in.gif\" border=\"0\" alt=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" title=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" /> ";
            $newu2umsg = "$newu2uimg<a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\">$lang[newu2u1] $newu2unum $lang[newu2u2]</a>";
        }
    }

========================================================================================
Replace Code With If You Want Image To Show When No U2U Is Received As Well As Received:
========================================================================================

// if the user is registered, check for new u2u's
    $newu2umsg = '';
    $newu2uimg = '';
    if (X_MEMBER) {
        $query = $db->query("SELECT count(readstatus) FROM $table_u2u WHERE owner='$self[username]' AND folder='Inbox' AND readstatus='no'");
        $newu2unum = $db->result($query, 0);
        if ($newu2unum > 0) {
            $newu2uimg = "<img src=\"$imgdir/u2u_in.gif\" border=\"0\" alt=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" title=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" /> ";
            $newu2umsg = "$newu2uimg<a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\">$lang[newu2u1] $newu2unum $lang[newu2u2]</a>";
        } else {
            $newu2uimg = "<img src=\"$imgdir/u2u_none.gif\" border=\"0\" alt=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" title=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" /> ";
            $newu2umsg = "$newu2uimg<a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\">$lang[newu2u1] $newu2unum $lang[newu2u2]</a>";
        }
    }

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

====================
Edit File: index.php
====================
=======================================================================================================================
NOTE: If you dont want to add the image in the whosonline and whosonline today skip this step.
=======================================================================================================================
==========
Find Code:
==========

            $memtally[] = "<a href=\"member.php?action=viewpro&amp;member=".rawurlencode($online['username'])."\">$pre$online[username]$suff</a>";

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

            $u2uimg1 = $u2uimg2 = '';
            if (X_MEMBER) {
                $u2uimg1 = " <a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\"><img src=\"$imgdir/u2u_in.gif\" border=\"0\" alt=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" title=\"$lang[newu2u1] $newu2unum $lang[newu2u2]\" /></a>";
                $u2uimg2 = " <a href=\"#\" onclick=\"Popup('u2u.php?action=send&amp;username=$online[username]', 'Window', 700, 450);\"><img src=\"$imgdir/u2u_none.gif\" border=\"0\" alt=\"$lang[banu2u] $online[username]\" title=\"$lang[banu2u] $online[username]\" /></a>";
            }
            if ($online['username'] == $xmbuser && $newu2unum > 0) {
                $memtally[] = "<a href=\"member.php?action=viewpro&amp;member=".rawurlencode($online['username'])."\">$pre$online[username]$suff</a>$u2uimg1";
            } else {
                $memtally[] = "<a href=\"member.php?action=viewpro&amp;member=".rawurlencode($online['username'])."\">$pre$online[username]$suff</a>$u2uimg2";
            }

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

                $todaymembers .= "$comma <a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">".$memberstoday['username']."</a>";

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

                $u2uimg3 = '';
                if (X_MEMBER) {
                    $u2uimg3 = " <a href=\"#\" onclick=\"Popup('u2u.php?action=send&amp;username=$memberstoday[username]', 'Window', 700, 450);\"><img src=\"$imgdir/u2u_none.gif\" border=\"0\" alt=\"$lang[banu2u] $memberstoday[username]\" title=\"$lang[banu2u] $memberstoday[username]\" /></a>";
                    $todaymembers .= "$comma <a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">".$memberstoday['username']."</a>$u2uimg3";
                } else {
                    $todaymembers .= "$comma <a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">".$memberstoday['username']."</a>";
                }

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

===================
Edit File: misc.php
===================

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

                $todaymembers .= $comma.'<a href="member.php?action=viewpro&amp;member='.rawurlencode($memberstoday['username']).'">'.$memberstoday['username'].'</a>';

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

                $u2uimg = '';
                if (X_MEMBER) {
                    $u2uimg = " <a href=\"#\" onclick=\"Popup('u2u.php?action=send&amp;username=$memberstoday[username]', 'Window', 700, 450);\"><img src=\"$imgdir/u2u_none.gif\" border=\"0\" alt=\"$lang[banu2u] $memberstoday[username]\" title=\"$lang[banu2u] $memberstoday[username]\" /></a>";
                    $todaymembers .= "$comma <a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">".$memberstoday['username']."</a>$u2uimg";
                } else {
                    $todaymembers .= "$comma <a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">".$memberstoday['username']."</a>";
                }

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

Upload provided images "u2u_in.gif" and "u2u_none.gif" to all theme folders.

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