PDA

View Full Version : [RELEASE v2] Auto-Welcome Email to New User


tubedogg
Thu 12th Apr '01, 5:32pm
Update - Apr 13 03:35 PM: I fixed another small bug that occured when you used email verification.

------------------------------------------------------------------------

This hack was requested by RobAC. It sends a welcome email to a new registrant at your board automatically. You can change the email wording to whatever you like, and turn the feature itself on or off in your Admin CP. If you require your new users to verify their email, it waits until that is done to send the welcome email. Otherwise, it sends it right away.

No demo, for obvious reasons. However, you can register at the vGeekIsland Board (link in my sig) to see it working. Or you could register there anyway, to help us build up our small community. ;)

For version: version 2, beta 5

Files needed: none

Files to edit: register.php

Templates to create: email_welcome, emailsubject_welcome

Instructions
1] Open register.php in an ASCII editor (you know at this point why you can't open it in a WYSIWYG editor; if not, read any of the hack threads in my sig).
2] Around line 414, find
eval("\$subject = \"".gettemplate("emailsubject_activateaccount",1,0)."\";");

mail($email,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");

}
Right below this, add
// send a welcome email using email_welcome and emailsubject_welcome templates, but don't
// send it now if they need to activate their account
if (!$verifyemail && $welcomeuser) {
eval("\$message = \"".gettemplate("email_welcome",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_welcome",1,0)."\";");

mail($newuseremail,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
}
// end send mail
Then, around line 489, find
eval("standarderror(\"".gettemplate("error_moderateuser")."\");");
} else {
Add right below it
// send a welcome email using email_welcome and emailsubject_welcome templates but only if it's on
if ($welcomeuser) { $email = $userinfo[email];
$username = $userinfo[username];
eval("\$message = \"".gettemplate("email_welcome",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_welcome",1,0)."\";");
mail ($email,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
}
// end send mail
3] Save and upload register.php. Then upload welcomemysql.php to your forums /admin directory. Go to http://yoururl.com/forums/admin/welcomemysql.php in a browser. If it is successful, it will display a link to you Admin CP.
4] Follow the link, and then create two new templates. First, one called email_welcome, filled with this:
Dear $username,

On behalf of the $bbtitle team, I would like to welcome you to our forums.
I hope you enjoy your stay and would like you to know that if you ever have any problems, please do not hesitate to contact me or one of the other team members.
I have listed our emails below for future reference.

Once again, thanks for joining us!
I hope you have a long and enjoyable stay with us.

Sincerely,
the $bbtitle team
Then, create another one called emailsubject_welcome and fill it with this:
Welcome to $bbtitle!
That's it. You can check out the new option under "Change Options" in the Admin CP.

Instructions are also in the zip file - welcome.txt.

Please do not PM me or contact me via AIM or ICQ about this hack. Post your message here - I will see it and try to help you.

Enjoy!

Edit: Almost forgot this. In the email_welcome template, you have these variables available to you:
$username - inserts the username of the recipient
$bbtitle - inserts the title of your BB
$u - inserts the userid of the recipient
$email - inserts the email address of the recipient
$webmasteremail - inserts the webmaster's email address

chrispadfield
Thu 12th Apr '01, 6:13pm
thanks for writing this out. I have been meaning to add this is and glad you have done.

jojo85
Thu 12th Apr '01, 6:31pm
Oh :)
Thx you very much guy :D

bokhalifa
Thu 12th Apr '01, 6:33pm
good hack ;)
thanks

tubedogg

RobAC
Thu 12th Apr '01, 10:24pm
Hmmmmm....Kevin, when does the email get sent out to the user? I ran a test twice by registering the username of test and I didn't receive the welcome email. It is set to YES in the control panel and the hack installation was successful. It was a breeze to install. Any ideas?

tubedogg
Fri 13th Apr '01, 9:59am
If you use email verification, it should get sent after the email is verified. If not, it should get sent right after registration.

Double-check that you saved and reuploaded register.php (I forgot to do this at first...;)).

Other than that, I can't think of any reason why it wouldn't work...You said it appeared in the control panel, which is right. And it's set to yes, which is right.

Hmm...one thing to try. On lines 426 and 498, which should look like this:
mail ($newuseremail,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
change it to this
mail($newuseremail,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");

I can't imagine that would make a difference, though...

RobAC
Fri 13th Apr '01, 10:04am
Verifying now....code is all there in register.php. I'll try making the code change you suggest and see what happens. I registered two separate test users last night and did not receive the email. :(

RobAC
Fri 13th Apr '01, 10:23am
It worked! Taking that space out after "mail" in the code worked. Don't ask me why, it doesn't make any sense, but I've tested it twice with email verification turned off and on and it worked both times.

However, there is something strange...with email verification turned off, the message starts out as expected:

Welcome test, (test is the username)

With email verification turned on, the message received after verification starts out like this:

Welcome ,


Any ideas?

tubedogg
Fri 13th Apr '01, 10:30am
On line 493 of register.php, try changing
$emails = $DB_site->query_first("SELECT email,username FROM user WHERE userid='$u'");
to
$emails = $DB_site->query("SELECT email,username FROM user WHERE userid='$u'");

RobAC
Fri 13th Apr '01, 10:41am
No email sent. :(

tubedogg
Fri 13th Apr '01, 10:46am
On lines 493-495, try changing
$emails = $DB_site->query("SELECT email,username FROM user WHERE userid='$u'");
$email = $emails[email];
$username = $emails[username];
to this
$email = $userinfo[email];
$username = $userinfo[username];

RobAC
Fri 13th Apr '01, 10:58am
Bingo! Nice job Kevin. It works great now!

-Rob

tubedogg
Fri 13th Apr '01, 11:02am
It seems odd that no one else ran across this error mine...is no one else using email verification? Or is it just no one has installed it? :D Anyway I fixed the problem both in the instructions and the zip file.

RobAC
Fri 13th Apr '01, 11:23am
Oh oh......I just had a new member sign up and I received the welcome email! LOL Time to go look at the code again.... :)

Wayne Luke
Fri 13th Apr '01, 11:39am
Why not use $bbuserinfo[userid] and $bbuserinfo[email]. Would cut down on the number of queries needed in fact it should eliminate any extra queries.

These should contain valid data if the member is already registers.

jojo85
Fri 13th Apr '01, 11:50am
I prefer to wait the final release before install this hack cause the final release come soon :)...i hope :rolleyes:

tubedogg
Fri 13th Apr '01, 1:21pm
Originally posted by wluke
Why not use $bbuserinfo[userid] and $bbuserinfo[email]. Would cut down on the number of queries needed in fact it should eliminate any extra queries.
These should contain valid data if the member is already registers.

$userinfo contains the same info during verification
$userinfo=verifyid("user",$u,1,1);
which is why I used that. The other time it would happen (when verification is not required) I don't use any queries.

Rob: I think I found the problem, maybe. On line 497, try changing this
mail($newuseremail,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
to this
mail($email,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");

RobAC
Fri 13th Apr '01, 2:05pm
Nice job once again Kevin. Works great. I verified it with different email addresses. thanks!!!

mjames
Fri 13th Apr '01, 2:25pm
Thanks for the hack, Kevin! I was looking for something like this, but unfortunately, there isn't really a need, IMO, because you can vBulletin to verify all new user's e-mail, but just change the permissions so users awaiting e-mail confirmation can still view everything. Then, just edit the confirmation templates and viola, you have your own welcome message.

Jaxsdad
Tue 17th Apr '01, 10:47pm
I followed this to a T...NOTHING! I tried it several times tonight and got NO email!

I KNOW I did everything like you said, but it still doesnt work! It is checked YES in the CP and register.php was saved and uploaded to the server to the admin area.

I really want this to work...it would save me from doing it manually (Which I do EVERYTIME a new user signs up)!

JJR512
Wed 18th Apr '01, 1:03am
Tubedogg, you are an excellent hacker. However, I won't be using this hack for two reasons.

1. I have email verification on, so every new member gets an email already. If I want to include a welcome message in it, I could change a template, I think. I think two emails is unnecessary.

2. I (and my members) prefer a more personal touch than some auto-generated thing. Whenever a new person registers, whoever sees the new name first will post a welcome message to that member in our main chatting forum. Other people will reply with their own greetings. I don't think we've missed anyone in a long time (OK, we only have 190-some members and have been opened only 11 months, but still...)

You registered on my board, and there was a welcome message to you. You never posted anything, so I don't even know if you saw it. In case you missed it, look here: http://www.jjr512.com/forums/showthread.php?s=&threadid=21087&highlight=tubedogg :)

tubedogg
Wed 18th Apr '01, 12:43pm
You're right I never saw it :) I registered for whatever reason to test something and then just never posted. I have been busy lately, that's why I haven't been pumping out the hacks as much as usual ;) but I have more free time as of today so hopefully it's back to great hacking!

Maverick1236
Wed 23rd May '01, 11:39pm
everything is set up ok-but no welcome email is sent
also:
$emails = $DB_site->query_first("SELECT email,username FROM user WHERE userid='$u'");

i dont even see that line in my register.php

Spoker
Mon 28th May '01, 5:24pm
Does this hack work on the vbulletin final release?

c0bra
Tue 29th May '01, 1:20pm
I was just gonna ask the same question. :)

RobAC
Tue 29th May '01, 6:56pm
Yes. I'm running it on my Forums. Works great.

Spoker
Wed 30th May '01, 1:40am
tnx,
i'll check it out

freehtml
Fri 1st Jun '01, 7:33am
I had installed this hack for vB 2.0.0 final, also no email send

Eficrx
Fri 1st Jun '01, 11:56am
free html i just registered and it worked for me

Eficrx
Fri 1st Jun '01, 12:48pm
it doesnt seem to work for me on vb 2.0 :mad:

freehtml
Fri 1st Jun '01, 8:32pm
Originally posted by Eficrx
free html i just registered and it worked for me

maybe its because I had enable the verify email option?

Eficrx
Fri 1st Jun '01, 8:44pm
it doesnt seem to work for me either way i really want this hack too =(

Eficrx
Mon 4th Jun '01, 9:30am
yeah i think because you had the email option on.

kirck
Mon 4th Jun '01, 3:54pm
can't get this hack to work. I have double checked all the files but the emails are not being sent. I have run tests by registering as test but no luck. a little help please?

Eficrx
Mon 4th Jun '01, 5:03pm
same problem with me

kirck
Mon 4th Jun '01, 5:18pm
I got it, I did not turn off the email notification in the control panel.:rolleyes:

Eficrx
Mon 4th Jun '01, 5:35pm
i installed it wrong :D works now i got confused

kdog316
Thu 7th Jun '01, 12:24pm
when a member signed up on my board i recieved the e-mail:confused:

RobAC
Thu 7th Jun '01, 12:30pm
Go back through this thread because I had a similar problem and Tubedogg explained how to fix it.

kdog316
Thu 7th Jun '01, 12:43pm
worked thanks

FindSP.com
Fri 8th Jun '01, 1:29pm
How do I make it work with 2.0.1?

Please answer.. this feature could be great for my forum :)


Thanks.

Eficrx
Fri 8th Jun '01, 1:40pm
it should work with 2.01

FindSP.com
Fri 8th Jun '01, 3:05pm
well.. it doesn't send emails when I sign up or people who sign up..


can you help?

Sinema
Fri 8th Jun '01, 9:11pm
Loved this!

I finally got vBulleting Working and I came back to look for hacks :-) and this great one was the first!

Too Cool for Words :-)

Cold Steel
Mon 18th Jun '01, 1:03am
Originally posted by Eficrx
it should work with 2.01

Does it work for 2.0.1?

And can we please get this into the next version? :)

Iliana
Mon 23rd Jul '01, 7:52pm
I have attempted three times to install this hack and still no emails are received when registering my site. I have gone back and started from scratch and now I have the Welcome Email option listed three times on my Control Panel. Can someone help figure out what I'm doing wrong and how to get rid of the other two welcome Email options on my cp and get this hack to work for me? Please please please :)

THanks,

Iliana

Iliana
Wed 25th Jul '01, 9:15am
bumping this up in hopes that someone can help me :(

Ever since I tried this hack, I am not able to send emails through my CP to the members. I made a back up copy of the register.php file before messing with it and I copied it back over, once I discovered that the hack was not working for me.

Can someone PLEASE OH PRETTY PLEASE help me? :(

RobAC
Wed 25th Jul '01, 1:00pm
First of all, you may want to replace the "none" under the version of vBulletin in your user profile with the version of vBulletin that you're running.

Second, if you haven't done so already, make sure that you have entered valid registration information into your profile as per John's request.

amykhar
Thu 26th Jul '01, 2:09pm
It's not working for me either with version 2.0

I require email verification, and the welcome email is never sent. :(

Amy

Eficrx
Sat 28th Jul '01, 8:08pm
does this work on 2.01

datman99
Sun 5th Aug '01, 8:40pm
will this work on my VB 2.0.1?

Sinema
Sun 5th Aug '01, 9:53pm
Best thing is to try it and find out ..

I use 2.0.3 w/ vbPortal 3.0b and it works fine

Kaizen
Tue 7th Aug '01, 6:51am
I have version 2.0.3 and i have gone through the instructions and everything and it still doesn't work.

I have it so users have to verify there emails if that helps.

Plz help me - i really want this feature

Byron
Tue 21st Aug '01, 6:51pm
Hope that this useful hack be a standard feature in the next version. Possible?

bdjncox
Wed 22nd Aug '01, 10:47am
Same problem here...

Installed the hack with seemingly no problems. But, no welcome e-mails are being sent out. I tried re-installing the hack after the 2.03 upgrade but it still doesn't work and now I have two instances in my CP.

Anyone have an easy way to remove this from the CP so I can start over and try again?

LuBi
Wed 22nd Aug '01, 1:26pm
Can anyone make this script work with 2.0.3? I tried installing this as my first hack and it seemed not to work at all. I've created 3 test accounts all with no emails.

LuBi
Mon 3rd Sep '01, 11:00pm
Does this hack work with 2.0.3? yes or no still waiting...:(

Kaizen
Tue 4th Sep '01, 6:20am
doesnt work for me

i am 2.0.3

save yourself the hassle - might be implemented for next version

Originally posted by LuBi
Does this hack work with 2.0.3? yes or no still waiting...:(

Matt*is*thick
Tue 4th Sep '01, 1:34pm
Same here, no welcome email sent.

Can someone pleeeeeeeeease fix it?

grb123
Sun 9th Sep '01, 11:28am
If you look at register.php for v2.0.3 you will see that there are two instances of each of the lines you have to search for and replace/add. Don't know if that is different to earlier versions of vB, but it would be handy if someone could confirm what we should do.

LuBi
Sat 15th Sep '01, 11:32am
I wont be upgrading anytime soon I have to many goodies installed. Also no one ever stated anything like it would be implememnted in the next version. So I'm gonna to play with it and we'll see how it goes I'll post my findings.

TigerLily
Mon 1st Oct '01, 1:54pm
Is there any way to do this using the Private Messaging system instead of emailing new members? I've had a "welcome wagon" group of members welcoming the newbies using PMs for some time, but the community is growing so big and so fast that it's impossible to keep up anymore. I would love to find a way to automate a welcome PM for each new member. I've found that it gets the newbies used to the PM system, which they might otherwise skip over.

TigerLily:)

PS Would love to find a way to do this for someone's birthday too!

hacker
Mon 1st Oct '01, 8:15pm
I have installed the hack, but may have accidentally applied the welcomemysql.php twice! I now have four Email Options as shown.

How do I adjust it back to one? Also, after installing, is it OK to delete the welcomemysql.php file?:confused:

PS: I can't get it to work though the installation seems correct.

hacker
Mon 1st Oct '01, 10:59pm
I can't get it installed and am using 2.0.3. Anyway, are there instructions to uninstall the sections at the CP?

hacker
Tue 2nd Oct '01, 10:29am
If anyone can help, I would really appreciate it.

Steve Machol
Tue 2nd Oct '01, 11:47am
hacker,

I'm not familiar with this hack, but it looks like it creates a new table in the database. If that's true, then you my be able to fix the problem by going into phpMyAdmin and removing the duplicate tables.

Kaizen
Tue 2nd Oct '01, 2:00pm
Hey tubedog

does this hack work on:

vb 2.0.3 ?

also in register there are two identical lines - i cant get past the first step....

help

Cloughie
Tue 2nd Oct '01, 5:32pm
I tried this in 2.0.3 and no luck?

I removed the templates I made..

Can anyone tell me what else I need to remove to completely remove the hack?

hacker
Tue 2nd Oct '01, 8:30pm
Originally posted by smachol
hacker,

I'm not familiar with this hack, but it looks like it creates a new table in the database. If that's true, then you my be able to fix the problem by going into phpMyAdmin and removing the duplicate tables.

What are the tables to remove?

Steve Machol
Tue 2nd Oct '01, 9:17pm
Originally posted by hacker


What are the tables to remove? Like I said I'm not familiar with this hack. You'll need to ask someone more familiar with it, or browse the database with phpMyAdmin and locate it manually.

hacker
Wed 3rd Oct '01, 4:22am
Does anyone know how to uninstall this hack?

Cloughie
Wed 3rd Oct '01, 4:52am
or does anyone know from the swl doc what table it makes?

Does it make a settings table ? Is that all?

If I delete the settings table will it be completely uninstalled?

thank you..

TubeDog?

Chen
Wed 3rd Oct '01, 5:02am
NO don't delete the setting table!!!
Jesus Christ are you nuts!

Run this query:
DELETE FROM setting WHERE varname='welcomeuser'
and AFTER you run this queyr run this one again:
INSERT INTO setting (settingid, settinggroupid, title, varname, value, description, optioncode, displayorder) VALUES (NULL,'6','Send Welcome Email','welcomeuser','1','If you wish for a welcome email to be sent when a user registers, select Yes. You can change what the email says by editing the emailsubject_welcome and email_welcome templates.','yesno','16')

Cloughie
Wed 3rd Oct '01, 5:09am
Originally posted by FireFly

Jesus Christ are you nuts!



LOL, this made me laugh....

Thank you very much Firefly!!! Exaclty what I needed...

hacker
Wed 3rd Oct '01, 5:51am
Firefly, if I only do Step one , would this take out everything from the mtSQL database? And if I delete the code I inserted or replace the code back to the original, it would be an uninstall?

If I do both Steps 1 and 2 queries as suggested but without modifying the code, does is mean that the Hack will remain, but with one instance of the Welcome Email at the CP?

hacker
Thu 4th Oct '01, 12:11am
Also, I read through the posts, no one seems to know whether this hack can work with 2.0.3.

Chen
Thu 4th Oct '01, 2:28am
Originally posted by hacker
Firefly, if I only do Step one , would this take out everything from the mtSQL database? And if I delete the code I inserted or replace the code back to the original, it would be an uninstall?

If I do both Steps 1 and 2 queries as suggested but without modifying the code, does is mean that the Hack will remain, but with one instance of the Welcome Email at the CP?
Yes, and yes.

hacker
Thu 4th Oct '01, 2:34am
Firefly:

One last thing, does it work with 2.0.3? All the previous posters say it can't work, and I can't seem to get it to work also, even with email verification shut off.

Thanks again for your help. Which part of Israel are you in?

Chen
Thu 4th Oct '01, 2:46am
I have no idea, sorry. Not my hack, and I've never used it in the past (maybe I did and I can't remember ;)).

I'm from Tel Aviv.

hacker
Thu 4th Oct '01, 5:52am
Firefly's uninstall worked for the database. The majority of people here could not get this hack to work. I tried, and I couldn't no matter what I did and double checked. I've installed about 7-8 hacks but this still mystifies me.

Thanks for the trouble, Firefly.

Heineken77
Sun 14th Oct '01, 4:51am
I would LOVE to hear that this has been fixed to work with 2.0.3!! Is there anything close to this hack that works?

Thanks.

Tubedog you kick a$$!!! :):D

Byron
Tue 23rd Oct '01, 5:15am
I have an idea for this welcome new members function. Need a small modification.

Please take a look at http://vbulletin.com/forum/showthread.php?s=&postid=190968&t=5703#post190968

Byron
Wed 24th Oct '01, 9:25am
Does this work on V2.03? My install was unsuccessful.

Cloughie
Wed 24th Oct '01, 12:52pm
this would be an awesome hack if it worked :(

Heineken77
Sat 27th Oct '01, 12:23pm
I hear it does work, just not for 2.0.3 yet, the man just needs some time :)