Title: U2U Welcome Message v1.0

Author: John Briggs
Updated For 1.9.8 by: WormHole @ XMB Garage

Description:
This modification will give you the option in admin panel to set who the sender of the U2U welcome message is from.
This modification will give you the option in admin panel to make a custom message in admin panel that will be sent via U2U.
This modification will give you the option in admin panel to turn it on-off in settings.

Copyright:  2009 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 SP3/SP4

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. A copy is provided with this software package.

=======================================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin Panel -> Insert Raw SQL
==============================

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

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

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

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

        // U2U Welcome Message Mod Begin
         $u2uwelcomeon = $u2uwelcomeoff = '';
         settingHTML('u2uwelcomestatus', $u2uwelcomeon, $u2uwelcomeoff);
        // U2U Welcome Message Mod End

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

        $lang['spell_checker'] .= $spell_off_reason;

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

        // U2U Welcome Message Mod Begin
        $SETTINGS['u2uwelcomefrom'] = stripslashes($SETTINGS['u2uwelcomefrom']);
        $SETTINGS['u2uwelcomesubject'] = stripslashes($SETTINGS['u2uwelcomesubject']);
        $SETTINGS['u2uwelcomemessage'] = stripslashes($SETTINGS['u2uwelcomemessage']);
        // U2U Welcome Message Mod End

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

        printsetting4($lang['tickercontents'], 'tickercontentsnew', stripslashes($SETTINGS['tickercontents']), 5, 50);
        ?>

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

        <!-- U2U Welcome Message Mod Begin -->
        <tr>
        <td class="tablerow" bgcolor="<?php echo $THEME['altbg2']?>" colspan="2">&nbsp;</td>
        </tr>
        <tr>
        <td bgcolor="<?php echo $THEME['altbg1']?>" colspan="2" class="category"><strong><font color="<?php echo $THEME['cattext']?>">&raquo;&nbsp;<?php echo $lang['u2uwelcomesettings']?></font></strong></td>
        </tr>
        <?php
        printsetting1($lang['u2uwelcomestatus'], 'u2uwelcomestatusnew', $u2uwelcomeon, $u2uwelcomeoff);
        printsetting2($lang['u2uwelcomefrom'], 'u2uwelcomefromnew', $SETTINGS['u2uwelcomefrom'], 32);
        printsetting2($lang['u2uwelcomesubject'], 'u2uwelcomesubjectnew', $SETTINGS['u2uwelcomesubject'], 32);
        ?>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $THEME['altbg1']?>" valign="top"><?php echo $lang['u2uwelcomemessage']?></td>
        <td class="tablerow" bgcolor="<?php echo $THEME['altbg2']?>"><textarea rows="5" name="u2uwelcomemessagenew" cols="50"><?php echo $SETTINGS['u2uwelcomemessage']?></textarea></td>
        </tr>
        <!-- U2U Welcome Message Mod End -->

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

        $onlinetoday_statusnew = formOnOff('onlinetoday_statusnew');

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

        // U2U Welcome Message Mod Begin
        $u2uwelcomestatusnew = formOnOff('u2uwelcomestatusnew');
        $u2uwelcomefromnew = addslashes(formVar('u2uwelcomefromnew'));
        $u2uwelcomesubjectnew = addslashes(formVar('u2uwelcomesubjectnew'));
        $u2uwelcomemessagenew = addslashes(formVar('u2uwelcomemessagenew'));
        // U2U Welcome Message Mod End

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

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

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

        $db->query("UPDATE ".X_PREFIX."settings SET
            u2uwelcomestatus='$u2uwelcomestatusnew',
            u2uwelcomefrom='$u2uwelcomefromnew',
            u2uwelcomesubject='$u2uwelcomesubjectnew',
            u2uwelcomemessage='$u2uwelcomemessagenew',


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

// U2U Welcome Message Mod Begin
$lang['u2uwelcomestatus'] = "U2U welcome message status:";
$lang['u2uwelcomefrom'] = "U2U welcome from username:";
$lang['u2uwelcomesubject'] = "U2U welcome message subject:";
$lang['u2uwelcomemessage'] = "U2U welcome message contents:";
$lang['u2uwelcomesettings'] = "U2U Feature Settings";
// U2U Welcome Message Mod End

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

            if ($SETTINGS['notifyonreg'] != 'off') {
                if ($SETTINGS['notifyonreg'] == 'u2u') {
                    $mailquery = $db->query("SELECT username FROM ".X_PREFIX."members WHERE status='Super Administrator'");
                    while($admin = $db->fetch_array($mailquery)) {
                        $db->query("INSERT INTO ".X_PREFIX."u2u (u2uid, msgto, msgfrom, type, owner, folder, subject, message, dateline, readstatus, sentstatus) VALUES ('', '$admin[username]', '".addslashes($bbname)."', 'incoming', '$admin[username]', 'Inbox', '$lang[textnewmember]', '$lang[textnewmember2]', '".$onlinetime."', 'no', 'yes')");
                    }
                    $db->free_result($mailquery);
                } else {
                    $headers[] = "From: $bbname <$SETTINGS[adminemail]>";
                    $headers[] = "X-Sender: <$SETTINGS[adminemail]>";
                    $headers[] = 'X-Mailer: PHP';
                    $headers[] = 'X-AntiAbuse: Board servername - '.$SETTINGS['bbname'];
                    $headers[] = 'X-AntiAbuse: Username - '.$xmbuser;
                    $headers[] = 'X-Priority: 2';
                    $headers[] = "Return-Path: <$SETTINGS[adminemail]>";
                    $headers[] = 'Content-Type: text/plain; charset=ASCII';
                    $headers = implode("\r\n", $headers);

                    $mailquery = $db->query("SELECT email FROM ".X_PREFIX."members WHERE status = 'Super Administrator'");
                    while($notify = $db->fetch_array($mailquery)) {
                        altMail($notify['email'], $lang['textnewmember'], $lang['textnewmember2'], $headers);
                    }
                    $db->free_result($mailquery);
                }
            }

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

            // U2U Welcome Message Mod Begin
            if ($SETTINGS['u2uwelcomestatus'] == 'on') {
                if ($SETTINGS['u2uwelcomefrom'] != '' && $SETTINGS['u2uwelcomesubject'] != '' && $SETTINGS['u2uwelcomemessage'] != '') {
                    $u2uwelcomemessage = addslashes($u2uwelcomemessage);
                    $db->query("INSERT INTO ".X_PREFIX."u2u (u2uid, msgto, msgfrom, type, owner, folder, subject, message, dateline, readstatus, sentstatus) VALUES ('', '$username', '$u2uwelcomefrom', 'incoming', '$username', 'Inbox', '$u2uwelcomesubject', '$u2uwelcomemessage', '$onlinetime', 'no', 'yes')");
                }
            }
            // U2U Welcome Message Mod End

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