vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   New User Welcome PM [v2] (https://vborg.vbsupport.ru/showthread.php?t=63269)

rob_daemon 04-24-2004 07:55 AM

Queries are commands that add to/change the database. You can run queries in phpMyAdmin (which is generally found in your webhost's control panel).

SnowBot 04-24-2004 10:56 PM

installed with no problems, edited the "0" to "1" works fine :) Great hack and thanks.

Kwak 04-25-2004 03:20 AM

When it says run the following queries, do you go to phpadmin --> click SQL --> and copy and paste all the queries onto the large white textbox?

rob_daemon 04-25-2004 08:41 AM

Yup... exactly.

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'''14000);
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (NULL'0''setting_regpmfrom_title''User Who Sends Automatic PM Upon Registration''5000');
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (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'15001);
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (NULL'0''setting_regpmtext_title''Welcome PM Text''5000');
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (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!'''16000);
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (NULL'0''setting_regpmtitle_title''Title Of the PM That is Automatically Sent to New Users''5000');
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (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');

// ##############################################################################################

------------ Nextyou MUST goAdmin 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.

mtha 05-02-2004 04:33 PM

wondering how this one related to the version for vB2.x

https://vborg.vbsupport.ru/showthrea...fault+PM+users

rob_daemon 05-02-2004 04:53 PM

Quote:

Originally Posted by Fluous
But can you tell me where to find the customize to edit the message? I tried the register.php and searching all the templates.

It is in the vBulletin Options --> User Registration Settings --> Registration PM Text

Also, Notepad doesn't understand UNIX line-breaks well (which is why you were having the problem). Use WordPad or JEdit (or something similar) to edit PHP files.

Quote:

Originally Posted by mtha
wondering how this one related to the version for vB2.x

https://vborg.vbsupport.ru/showthrea...fault+PM+users

It isn't... I wrote this one myself without even knowing the other version existed.

Fluous 05-02-2004 04:59 PM

Thank you, after I posted I got my lazy self up to search through the pages and found that screenshot in there. This is a great hack to include so that I can tell my users about the skin options when they register.

CharlieBrownDE 05-06-2004 08:42 AM

how safe is the installation in 3.0.1? are there problems with that or can one install this expansion without problems?

rob_daemon 05-07-2004 04:38 AM

Well, as of the most recent there haven't been any reported problems. This hack works with 3.0.0 and greater. I haven't had any problems with this hack, but if you do run into a problem I will try to help you work it out.


All times are GMT. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02089 seconds
  • Memory Usage 1,807KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete