Fluous |
05-02-2004 03:27 PM |
Okay, I'm having a bit of trouble. I open the welcome hack txt, and it doesnt really give instructions. Just has a big glob of php. So erm.... lol.
Also an idea, that would really be nice to take into consideration is. In your admincp, if you can just edit the text there, instead of having to open up the php file to do it. And if you can tell me how to do a "x" username, like the php code that woudl be cool.
This is what I mean by messy, and I can't tell where the seperate queries are. :speechless:
Edit: NVM, my notepad must have been really messy, I'll just work right off of this post. (I had turned on word wrap but meh)
PHP Code:
################################################################### ||
|| # Welcome PM Hack by rob_daemon # ||
|| # LAST UPDATED: Tue Apr 13 2004 19:34 PST # ||
|| # --------------------------------------------------------------- # ||
|| # VARIOUS MODIDIFICATIONS:
|| # Boofo - Addslashes to username
|| # Cloudrunner - Table prefix in SQL queries
|| ################################################################### ||
\*=====================================================================*/
INSTRUCTIONS:
------------ Open phpMyAdmin and run the following queries:
// ##############################################################################################
INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('regpmfrom', 'register', '1', '1', '', 140, 0, 0);
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmfrom_title', 'User Who Sends Automatic PM Upon Registration', '5000');
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmfrom_desc', 'Enter the user ID of the person whose account you\'d like to be used when sending new users a welcome PM upon registering.', '5000');
INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('regpmtext', 'register', 'Hi $username and welcome to $bbtitle!\r\n\r\nWe appreciate you taking the time to register on our site and we hope you enjoy your stay.\r\n\r\nIf you have any questions, you can ask an administrator for assistance.\r\n\r\nWe hope to see you around.\r\n\r\nSincerely,\r\nThe $bbtitle staff', 'Hi $username and welcome to $bbtitle!\r\n\r\nWe appreciate you taking the time to register on our site and we hope you enjoy your stay.\r\n\r\nIf you have any questions, you can ask an administrator for assistance.\r\n\r\nWe hope to see you around.\r\n\r\nSincerely,\r\nThe $bbtitle staff', 'textarea', 150, 0, 1);
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmtext_title', 'Welcome PM Text', '5000');
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmtext_desc', 'Set the text of the PM sent to all new users.<br />\r<br />\rNote: You can use the following variables to specify the <b>user\'s</b> information: $username, $userid, $email. And you can use the $bbtitle to specify the board\'s name.', '5000');
INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('regpmtitle', 'register', 'Welcome to $bbtitle!', 'Welcome to $bbtitle!', '', 160, 0, 0);
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmtitle_title', 'Title Of the PM That is Automatically Sent to New Users', '5000');
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '0', 'setting_regpmtitle_desc', 'Set the title of the PM that is sent to all new users automatically. You can use the same variables as the ones that you can use for the PM text (see above).', '5000');
// ##############################################################################################
------------ Next, you MUST go: Admin CP --> Options --> vBulletin Options --> User Registration Options --> Save
-------- If you don't do this, you will get SQL errors when a user registers!
------------ Next, open ./register.php and look for:
// ##############################################################################################
if ($vboptions['newuseremail'] != '')
{
if ($havefields)
{
$DB_site->data_seek(0, $profilefields);
while ($profilefield = $DB_site->fetch_array($profilefields))
{
$varname = "field$profilefield[profilefieldid]";
$cfield = $$varname;
$customfields .= "$profilefield[title] : $cfield\n";
}
}
$username = $_POST['username'];
$email = $_POST['email'];
eval(fetch_email_phrases('newuser', 0));
vbmail($vboptions['newuseremail'], $subject, $message);
}
// ##############################################################################################
------------ AFTER ADD:
// ##############################################################################################
// ###################################################################
// # WELCOME PM HACK BY rob_daemon
// ###################################################################
$username = $_POST['username'];
// Process each one of the replacement vars
$vars = array(
'$bbtitle' => $vboptions['bbtitle'],
'$username' => $username,
'$email' => $email,
'$userid' => $userid
);
$pmoptions['regpmtext'] = $vboptions['regpmtext'];
$pmoptions['regpmtitle'] = $vboptions['regpmtitle'];
$pmoptions['regpmfrom'] = $vboptions['regpmfrom'];
// Now that we have the options, we need to process eaach of the
// vars we can use
foreach($vars AS $_key => $_value)
{
$pmoptions['regpmtext'] = str_replace($_key, $_value, $pmoptions['regpmtext']);
$pmoptions['regpmtitle'] = str_replace($_key, $_value, $pmoptions['regpmtitle']);
}
$get_pm_from = $DB_site->query_first("SELECT username,userid FROM " . TABLE_PREFIX . "user WHERE userid=$pmoptions[regpmfrom]");
// Send the new owner a PM
$DB_site->query(
"INSERT INTO " . TABLE_PREFIX . "pmtext
(
fromuserid,
fromusername,
title,
message,
touserarray,
iconid,
dateline,
showsignature,
allowsmilie
)
VALUES
(
$get_pm_from[userid],
'$get_pm_from[username]',
'$pmoptions[regpmtitle]',
'" . addslashes($pmoptions['regpmtext']) . "',
'" . addslashes(serialize(array($userid => $username))) . "',
0,
" . TIMENOW . ",
1,
1
)"
);
$pmtextid = $DB_site->insert_id();
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=pmunread+1, pmpopup=2 WHERE userid=$userid");
$DB_site->query(
"INSERT INTO " . TABLE_PREFIX . "pm
(
pmtextid,
userid,
folderid,
messageread
)
VALUES
(
'$pmtextid',
'$userid',
'0',
'0'
)"
);
// ###################################################################
// # END WELCOME PM HACK
// ###################################################################
// ##############################################################################################
You are done :)
?>
k, i got it all, installed perfectly,
[high]* Fluous clicked install.
[/high]
But can you tell me where to find the customize to edit the message? I tried the register.php and searching all the templates.
|