Resend Registration Email

Permalink 1 user found helpful
Thanks to anyone in advance for helping with this...

I have search around and it would seem that as an administrator, you cant re-send the confirmation email to a member.

I know you can do this with basic joomla back end, so am amazed there is nothing in concrete5.

Does anyone know if this is planned for a future update, or if there is an add-on that can perform this function?

deanhawthornthwaite
View Replies:
INTcommunications replied on at Permalink Reply
INTcommunications
I would think that if it is in the database, you should be able to write a single page to access the confirmation emails. I don't know if it is saved or not though. If it's not saved - it shouldn't be that hard to build a function to save them at registration. But if they are identical ( stock ) then you should be able write something that sends it from a list of the registered users that you click a button to send them.

Just search around here - I am sure someone has written an add-on to send email to a registered user.
here's one -http://www.concrete5.org/marketplace/addons/mailing-list/...

this one is free -http://www.concrete5.org/marketplace/addons/mailer/...
Rob7 replied on at Permalink Reply
I'm also wondering how others manage this, it seems to be a missing but needed feature. So far have found that the message is stored in the Logs table and the validation hash at the end of the email is stored in UserValidationHashes table, but I have yet to find a way to resend the message or an easy way to link a log entry to a user for quick retrieval. It may well be that the email needs to be reconstructed using the data in the UserValidationHashes table (presuming that the link is always pointing to yourdomain/login/v/).
Phallanx replied on at Permalink Reply
Phallanx
@Rob7
Registration isn't very well encapsulated.

You have some in the UserInfo object, some in the validation/identifier helper and some in the registration single page.

Given the user ID, you can query the table to get the hash and from there send an email.

However. The hash has a lifetime and you should create a new fresh one anyway if re-sending. So deleting the old one, generating the new one, updating the DB and sending the email, while not difficult, gets a bit icky.

Take a look at the registration.php in the concrete/core/single pages (about line 199) and the change_password function in login.php at about line 392.
Rob7 replied on at Permalink Reply
Thanks Phallanx, that's much appreciated and timely as I have just started editing overrides for the registration and login controllers and created a resend_authentication method based on the forgot_password one.

I also didn't know that the hash has a lifetime. I saw the reset code used in password renewal and was going to ignore it, will now refer to it more carefully!
INTcommunications replied on at Permalink Reply
INTcommunications
If you can find where the email was created - then write a function to save it to a database table for future use. i.e. re-send. If you need to see a script that does this look at the form block. It takes all submitted forms and sends/ writes to database - so you can read them in the Dashboard.
deanhawthornthwaite replied on at Permalink Reply
deanhawthornthwaite
WOW I didn't realise i would spark such in depth knowledge from you guys!

Many thanks Rob7, Phallanx and INTcommunications, for all your input.
I have no idea what you are discussing, but if you do get to a resolution that works for a lowly designer like me I would be keen to implement it.

Will keep monitoring your feedback.

Cheers, Dean.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
Try this package I whipped up in response to your question.

To install:

1) Download the attached zip file
2) Unzip it to your local computer.
3) Upload the resulting 'resend_validation' folder to your [root]/packages folder.
4) Visit 'Dashboard->Extend Concrete5'
5) Scroll down until you find the 'Resend Validation' package and click 'Install'
6) After it's installed, visit 'Dashboard->Resend Validation' under the 'Members' group

Let me know how you make out.
Rob7 replied on at Permalink Reply
Thanks MHawke, that's great. I've installed and tested it, it has worked a treat so far.
deanhawthornthwaite replied on at Permalink Reply
deanhawthornthwaite
Thanks a ton MHawke, for creating this after my first post.

I have installed the add-on and gone to the resend validation emails, but there is only one name showing?

Is that because there is a time limit to use this function?
mhawke replied on at Permalink Reply
mhawke
It just checks for any users that have not yet clicked the link in the validation email that was sent to them. If there is only one showing up then there must be only one member in your database that has not validated.

Try registering a fake member and see if they show up.
deanhawthornthwaite replied on at Permalink Reply
deanhawthornthwaite
hi mhawke, i added a fake registration for another email address i have.

Sorry but it didn't show up either before i activated the user of afterwards.

I am having problems with my site and database at the moment so will just leave it for now, especially as other have used successfully.

Thanks for all your work. Dean.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
Do you have your site registration set to require email validation?

Dashboard->System and Settings->Public Registration

See attached
mhawke replied on at Permalink Reply
mhawke
To see the database contents for this, go to your host's Control Panel and use the phpMyAdmin utility and have a look in the UserValidationHashes table. The entries with '0' in the 'uDateRedeemed' column should show up on the list.
deanhawthornthwaite replied on at Permalink Reply 2 Attachments
deanhawthornthwaite
I'm not sure what I'm looking at here, so have attached screen shots of the tables. you get 2 different results depending on where you click on the table name?
mhawke replied on at Permalink Reply 1 Attachment
mhawke
When you click the 'Browse' tab, you are then looking at the actual table contents. At the moment, you have zero members who have not validated their email addresses. User #9 (uID=9) clicked on the link in the validation email on Wednesday, Dec 4th just before 14:00 hours GMT. Have a look in the 'Users' table to find out who uID=9 is. Currently, nobody should be showing up in my Resend Validation block simply because there are no un-validated members. See attached.

If you have your registration system set up properly so that new registrants must validate their email address (see my post above) then what happens if you register a new, fake member and DON'T click the link in the email that is originally sent out? This table should get a new row with a uDateRedeemed value of '0'. This new, fake member should show up in the Resend Validation drop-down list until such time as the fake member clicks the link in their validation email.

All my block does is delete the original row for the chosen member, re-create a new row for that user (with a more recent timestamp) and send them a new validation email.
deanhawthornthwaite replied on at Permalink Reply
deanhawthornthwaite
OK i can see the logic of this, thanks for the breakdown.
I created a dummy user without clicking verification, and the uDateRedeemed value is '0'.

In the Users table under ulsActive i can see all users have a '1' except for my new dummy one.
The weird thing is when i go back to dashboard/resend validation, my dummy is not there, and user 9 is still the only one showing even though in ulsActive user 9 has a '0'.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
Check 'Dashboard->System and Settings->Cache and Speed Settings' and make sure all your caching is off. Is it possible you have 'Full Page caching' on?

Se attached
Rob7 replied on at Permalink Reply
I also need the allow a user to trigger this from the front end. In the end I managed to to this by adding the following method to the login control (based on the password reset method). I have a custom theme which uses code also similar to the password reset form to call this. Thought I'd include it if it helps anyone, am new to this so be sure to test it before use.
public function resend_validation() {
        $loginData['success'] = 0;
        $vs = Loader::helper('validation/strings');
        $em = $this->post('uEmail');
        try {
            if (!$vs->email($em)) {
                throw new Exception(t('Invalid email address.'));
            }
            $oUser = UserInfo::getByEmail($em);
            if (!$oUser) {
                throw new Exception(t('We have no record of that email address.'));
            }
            //generate hash that'll be used to authenticate user, allowing them to confirm login
            $h = Loader::helper('validation/identifier');
            $uHash = $h->generate('UserValidationHashes', 'uHash');


Does anyone know how long before this auto-expires and if a new user registration is removed at the expiry? This would be useful to help unclutter the user table if many register but few confirm the email.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
I like your idea of adding a function to the registration page but perhaps it' a bit 'heavy' to ask the typical client to know how to override the registration files so my first iteration of this was as an 'External Form' that could be added anywhere on the site as a block.

I have attached another zip. This one contains 2 files. The one called 'reset_validation.form' should be renamed 'resend_validation.php' and placed into [root]/blocks/external_form/forms .

The file called 'resend_validation.controller' also needs to be renamed 'resend_validation.php' but placed into [root]/blocks/external_form/forms/controllers .

To add it anywhere on your site, add an 'External Block' and choose 'Resend Validation' as the form.
mhawke replied on at Permalink Reply
mhawke
EDIT: For the correct answer, see Phallanx's answer below this one.

To answer your question about the life of the hash:

Line 435 of [root]/concrete/config/base.php sets the constant called "USER_CHANGE_PASSWORD_URL_LIFETIME" to be 7200 (2 hours)

You should be able to redefine that constant in your [root]/config/site.php file.

Line 399 of [root]/concrete/core/controllers/single_pages/login.php checks the age.
Phallanx replied on at Permalink Reply
Phallanx
@mhawke

Nice work.

>Line 399 of [root]/concrete/core/controllers/single_pages/login.php checks the age.

Yeah. That check of the hash should be in the v function on line 383 ish. It looks to me like a sign-up has no expiry (it should, but longer than 2 hrs) and old signup hashes live forever even if already redeemed-not good.
mhawke replied on at Permalink Reply
mhawke
Sorry, I was searching the core for "USER_CHANGE_PASSWORD_URL_LIFETIME" which is only vaguely related to what we need.

Perhaps the lack of an expiry date is by design but I think the old ones should be deleted when the validation email link is clicked.