Code:
#############################################################
## MOD Title : Send PM On User Register
## MOD Author : (Raven) http://ravenphpscripts.com (Chatserv) http://www.nukeresources.com
## Description : This mod will send a welcome message (PM) to all new users upon activating their account.
## This is for use in Your_Account activations, not Forum activations.
## MOD Version : 1.0.0
## Compatibility: All versions of Nuke
##
## Other Credits:
## -- Inspired by and Adapted from John B. Abela's © Forum Send PM On User Register Mod ©
## http://www.phpbb2mods.com
##
## -- Contributed by Chatserv 2005
## Assign a group_id to new users to get rid of user and group permission errors in forums.
## http://www.nukefixes.com -- http://www.nukeresources.com
##
##
## Installation Level: easy
## Installation Time: ~3 minutes
##
## Files To Edit:
## modules/Your_Account/index.php
## modules/Your_Account/language/lang-english.php
##
## Included Files: None
##
## History:
## 1.0.0 - July 6, 2005 - initial release
##
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://ravenphpscripts.com for the latest version of this
## MOD. Downloading this MOD from other sites could cause malicious code to enter into your phpnuke
## site. As such, Raven will not offer support for MOD's not offered/downloaded from this site.
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
modules/Your_Account/index.php
#
#-----[ FIND ]------------------------------------------
#
function activate
#
#-----[ THEN FIND ]------------------------------------------
#
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");
include("header.php");
title(""._ACTIVATIONYES."");
OpenTable();
#
#-----[ AFTER, ADD ]------------------------------------------
#
/**************************************************************************************************/
/* Mod Name : Your_Account Mod to Send PM On User Register */
/* Author : Raven http://ravenphpscripts.com -- http://ravenwebhosting.com */
/* Version : 1.0.0 */
/* Release Date : July 6, 2005 */
/* License : GNU/GPL - Use it, modify it, but please respect the Credits */
/* Usage Notes : Be sure that you have added the language text to the language file and that you */
/* have modified it for your site. */
/**************************************************************************************************/
/* Other Credits: */
/* -- Inspired by and Adapted from John B. Abela's © Forum Send PM On User Register Mod © */
/* http://www.phpbb2mods.com */
/* */
/* -- Contributed by Chatserv 2005 */
/* Assign a group_id to new users to get rid of user and group permission errors in forums. */
/* http://www.nukefixes.com -- http://www.nukeresources.com */
/**************************************************************************************************/
// BEGIN -- The following code is courtesy of Chatserv 2005 -- //
$pmResult = $db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='$row[username]'");
$pmRow = $db->sql_fetchrow($pmResult);
$guserid = intval($pmRow[user_id]);
$db->sql_query("INSERT INTO ".$prefix."_bbgroups (group_name, group_description, group_single_user, group_moderator) VALUES ('', 'Personal User', '1', '0')");
$group_id = $db->sql_nextid();
$db->sql_query("INSERT INTO ".$prefix."_bbuser_group (user_id, group_id, user_pending) VALUES ('$guserid', '$group_id', '0')");
// END -- The above code is courtesy of Chatserv 2005 -- //
$pmResult = $db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='"._PRIVMSGS_FROM_USERNAME."'");
$pmRow = $db->sql_fetchrow($pmResult);
$privmsgs_from_userid = intval($pmRow[user_id]);
$register_pm_subject = _REGISTER_PM_SUBJECT;
$register_pm = _REGISTER_PM;
$privmsgs_date = date("U");
$sql = "UPDATE ".$user_prefix."_users SET user_new_privmsg='1', user_last_privmsg='65534', user_unread_privmsg='1', user_popup_pm='1', user_notify='1', user_notify_pm='1' WHERE user_id='$guserid'";
if (!$db->sql_query($sql)) {
echo sprintf(_MYSQL_ERROR,'USERS').mysql_error();
CloseTable();
include('footer.php');
}
$sql = "INSERT INTO ".$user_prefix."_bbprivmsgs (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '" . str_replace("\'", "''", addslashes(sprintf($register_pm_subject,$sitename))) . "', '$privmsgs_from_userid', '$guserid', '$privmsgs_date', '0', '1', '1', '0')";
if (!$db->sql_query($sql)) {
echo sprintf(_MYSQL_ERROR,'_BBPRIVMSGS').mysql_error();
CloseTable();
include('footer.php');
}
$privmsgs_text = $register_pm_subject;
$privmsg_sent_id = $db->sql_nextid();
$sql = "INSERT INTO ".$user_prefix."_bbprivmsgs_text (privmsgs_text_id, privmsgs_text) VALUES ($privmsg_sent_id, '" . str_replace("\'", "''", addslashes(sprintf($register_pm,$username,$sitename,$sitename))) . "')";
if (!$db->sql_query($sql)) {
echo sprintf(_MYSQL_ERROR,'_BBPRIVMSGS_TEXT').mysql_error();
CloseTable();
include('footer.php');
}
/**************************************************************************************************/
/**************************************************************************************************/
#
#-----[ OPEN ]------------------------------------------
#
modules/Your_Account/language/lang-english.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// START - Send PM On User Register
/* Change the text 'Raven' in define("_PRIVMSGS_FROM_USERNAME","Raven"); to the name of the user that you want the Welcome message PM to be FROM
*/
global $sitename, $adminmail;
define("_MYSQL_ERROR","Unable to update %s table - MySQL said: ");
define("_PRIVMSGS_FROM_USERNAME","Raven");
define("_REGISTER_PM_SUBJECT","Welcome to $sitename");
define("_REGISTER_PM","Hello!<br /><br />Welcome to $sitename. <br /><br />We hope you enjoy your time at this site! <br /><br />Feel free to join in and share with others or start your own discussion! <br /><br />Before posting please take time to read <a href=\"http://ravenphpscripts.com/postp41533.html\" title=\"Welcome to $sitename - Read Me First\">[b]this welcome message[/b]</a><br /><br />~Enjoy!<br />$sitename Staff");
// END - Send PM On User Register
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
|