Email confirmation when registering

Permalink
Can someone point me in the right direction on how to turn on email confirmation for the registration form?

Lost
View Replies: View Best Answer
ymne replied on at Permalink Reply
ymne
I would like to know too! Thanks.
ymne replied on at Permalink Reply
ymne
Is there someone who can answer our question?

Thanks!
ymne replied on at Permalink Reply
ymne
I search everywhere to find this and really don't have a clue.

Please, help us.
There is no topic in the manual about that.

Is there someone nice who can help us on that matter?
andrew replied on at Permalink Reply
andrew
There is currently no way to do this.. Not something that you can "turn on."
ymne replied on at Permalink Reply
ymne
Hi Andrew!

Is it gonna be in the next update of C5?
Do you plan to have this kind of setup?

Thanks for your responding.
andrew replied on at Permalink Reply
andrew
As we're totally feature complete for the next release.

However, there may be a way for you to get what you want using C5 events, where you hook into system events and add your own code. So you'd hook into the on_user_add system event and run a function that sends emails.

I hope to get more documentation on this and some other things up over this weekend.
geojlc replied on at Permalink Reply
geojlc
This would be a really useful feature! I tried doing some of the on_user_add system events, but I'm not skilled enough with coding to figure it out!
sschildbach replied on at Permalink Reply
sschildbach
I know this is an old post, but anyone recently have a good tutorial on how to develop the code that sends an email confirmation when someone registers? In an ideal world, an email to the the person who registered, and an email to the site administrator to confirm the registration. If this is asking too much, is there someone who would like to do this for pay?
jeckerman replied on at Permalink Reply
jeckerman
I couldn't find anything either, but it should a fairly straight forward add-on to write. Would you want it to have it's own form building UI, or have it integrated with an exisiting form or form addon?

- Josh
12345j replied on at Permalink Reply
12345j
go to yoursite.com/index.php/dashboard/users/registration/ and there are options in the right sidebar- there is an option to send to the register, wouldn't be hard to send an email to admin to let him know.
sschildbach replied on at Permalink Reply
sschildbach
Thanks for responding JE but when you aren't well versed at PHP like many of us, it is not an easy add-on to write. If it is easy to write, are you available to write it? I'm able to pay for your work.

And, thanks for responding J, but there are no options on the register page to have an email sent, I've been using this page and know it pretty well. If you have found otherwise, please tell me where?
12345j replied on at Permalink Reply 1 Attachment
12345j
if you check email must be validated then they have to click on a link to register. see attached. ill look into some code to send to the admin.
12345j replied on at Permalink Reply 1 Attachment
12345j
here we go. upload this with a .php extension instead of .txt at root/controllers and give it a go. I haven't tested, so it may not work though
sschildbach replied on at Permalink Reply
sschildbach
Thanks J, I'll let you know how it goes soon.
sschildbach replied on at Permalink Reply
sschildbach
You are very generous to take this time. Two problems. I fixed this:
Parse error: syntax error, unexpected T_ELSE, expecting T_FUNCTION in /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php on line 209

by deleting an extra "}" on line 209, but when test registering I ran into this:
Fatal error: Call to a member function getUserEmail() on a non-object in /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php on line 144

To be more specific, because the devil is in the details with my request, the most important thing I need is the administrator to get an email when someone registers, so that administrator can review to make sure they are a part of the organization that this site is made for. second importance is the person registering getting an email. The email notification the administrator gets prevents the problem of pending registrations sitting for too long. Are you sure you don't want to go over this one on one through our profiles or emails, and then we post the final result?
12345j replied on at Permalink Reply 3 Attachments
12345j
ok, i tested it this time. put register.txt in your root/controllers folder, put register_user_email and user_register_approval_required in your root/mail folder renaming all extensions to .php make sure that the admin approval required is allowed too. Issues: I removed all register attributes other than the default, because it was throwing an error and I didn't want to deal with it. additionally, its not really clean code or anything, but it should get the job done.
sschildbach replied on at Permalink Reply
sschildbach
J, I really appreciate your help. I get these errors when I submit the registration, I'm following your directions inserting the code the best I can:

Warning: join() [function.join]: Invalid arguments passed in /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php on line 179

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php:179) in /Applications/MAMP/htdocs/seattlemusiciansC5/concrete/libraries/controller.php on line 333

I have two other people helping me with a different solution. Evidently, the core has the capability to send a notification email, but I haven't gotten that to work either.
sschildbach replied on at Permalink Reply
sschildbach
Good news: the test registration email did get a confirmation. Bad news: the admin did not get a notification email.
sschildbach replied on at Permalink Reply 1 Attachment
sschildbach
My last remaining question is the notification email sent to the admin is missing the "To Header" for the email. So we see the email attempt in the log of C5, but the admin does not get the email. Does anyone have an idea why this may be? See attachment. This general gist is: "Mail Exception Occurred. Unable to send mail: Missing To header"

DG1 & Jeckerman, you have been so generous, at this time I'm using 12345j's code and help. I might still turn to you guys, but so far 12345j is doing well. He is touching up the code off the forum post, so not to waste everyone's time. When he has it right, we will post the final result.
sschildbach replied on at Permalink Reply 1 Attachment
sschildbach
To be more specific, I have to have the registration be pending and manually approved by an administrator. See attached.
12345j replied on at Permalink Reply
12345j
ok, i did it the other way round. It should be simple to fix, check post solution soon.
dg1 replied on at Permalink Reply
I did write up instructions awhile ago on how to write code to email admin if a user registers so the admin knows when to approve the registration:
http://www.concrete5.org/community/forums/customizing_c5/new-user-n...

However, this code does not appear to be needed any more since 5.4.1. The release notes say this:

"You can define EMAIL_ADDRESS_REGISTER_NOTIFICATION and EMAIL_ADDRESS_REGISTER_NOTIFICATION_FROM to get notifications when new users register through your site."

I haven't actually tried it, but looks easy enough (no code to write).
dg1 replied on at Permalink Reply
Here is another thread with the syntax on how to configure it in site.php.

http://www.concrete5.org/community/forums/customizing_c5/email_addr...
sschildbach replied on at Permalink Reply
sschildbach
When I follow the directions from this thread (installing the two lines of code in site.php), I don't get any email notification. I'm using 5.4.1.1.
jeckerman replied on at Permalink Reply
jeckerman
Hi,

What OS and web server are you running C5 on?

- Josh
sschildbach replied on at Permalink Reply
sschildbach
Mac OS 10.6.7.
Running on MAMP on my local computer, localhost.
dg1 replied on at Permalink Reply
sschildbach,

I just did a quick test with the supported (preferred) method of adding the two lines as noted above to site.php on my 5.4.1.1 installation and it worked perfect the first time. I set my login registration option to "Registration is enabled, but must be manually approved", added the two lines to site.php and then I registered a user.

My admin user then received the following email:

-------------------------------
A new user has registered on your website. This account must be approved before it is active and may login.

User Name: dg1
Email Address: [email protected]

You may approve or remove this user account here:
http://localhost/concrete5.4.1.1/index.php/dashboard/users/search?u...
--------------------------------

There may be something on your system that is affecting the sending of emails. You might check your php.ini mail settings. I know on my windows system, I had to set SMTP and smtp_port.
12345j replied on at Permalink Reply
12345j
Yeah, that parts easy- is there a built in define to notify user without asking them to validate?
sschildbach replied on at Permalink Reply
sschildbach
Even discovered the reason for not getting the email dg1, the email was going into my spam (duh). Even though entering these 2 lines of code is preferred, I'm sticking with 12345j's approach. He and I spent time together off the forum and he put together some code that sends an email to both the registering user and the admin of the site. It gave me a better idea of how all of this works. After I get his ok, I will post the results. It might not be ideal to some, but I think it can be useful to others. Thank you for your help dg1.
dg1 replied on at Permalink Reply
Emailing the registering user is a nice feature. Glad you have worked out a solution with 12345j.
sschildbach replied on at Permalink Reply
sschildbach
I guess I really need my hand held through this process. You and J above are trying to help, but I still haven't gotten it. When following the long thread from your work, I get these php errors:

Warning: join() [function.join]: Invalid arguments passed in /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php on line 179

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/seattlemusiciansC5/controllers/register.php:179) in /Applications/MAMP/htdocs/seattlemusiciansC5/concrete/libraries/controller.php on line 333

Some people mention taking out ?> at the end of two files that didn't work for me. Neither the registration email or the admin email got an email notification. any idea where I went wrong? Without anyone's modifications, the registration clears, no php errors.
jeckerman replied on at Permalink Reply
jeckerman
Hi,

If possible, can you zip up your concrete5 site and send it to me, and I'll trouble shoot right here.

- Josh
sschildbach replied on at Permalink Reply
sschildbach
Thanks Josh, how about I leave out the concrete file version 5.4.1.1 so that I can email it to you (too big to email otherwize)? Which approach are you going to take? J, dg1, or your own apporach?
jeckerman replied on at Permalink Reply
jeckerman
Or better yet, whats your email and I'll send you my shared dropbox. This way nothing is left out. (Just in case).

I'll be using all three methods. :)

- Josh
jeckerman replied on at Permalink Reply
jeckerman
Good to hear you got it solved!

- Josh
cgroves replied on at Permalink Reply
I have the most current installation - I see no "send to register" in the right column. Would be nice, no one know that they have been approved until I email them back or they just give it a try.
12345j replied on at Permalink Best Answer Reply 3 Attachments
12345j
here we go. first change all extensions to .php.
upload register.php to root/controllers, and the other to to root/mail
sschildbach replied on at Permalink Reply
sschildbach
Thank you 12345j! I know 12345j's 3 file solution above is not for everyone, but I give it best answer too!

If you want a confirmation email to go to the user who registered AND a notification email to go to the site admin, this works great (not to mention, by putting the 3 files into the root folders mentioned, you learn a little about how C5 can be customized).
12345j replied on at Permalink Reply
12345j
Glad you like it. I am going to try to customize this to be included in 5.5, so look or this in the summer.
tallacman replied on at Permalink Reply
tallacman
This is a great drag and drop and configure solution. Thanks 12345J! (php master)