Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
We are using extended users on our web site to manage login accounts for the members of our sports club. Although we're not leveraging self registration from the front-end (because registration can only be done after formal sign-up) we are using index.php to add fields to the profile and are using profile.php to show the profile information and additional fields to the member and to make some fields, like the email address, editable by them.

Is it possible with the current extended users addon to send an email confirmation message to the user?

The idea is to implement the following process, which is kind of similar to the self-registration process but adapts a profile instead of creates it:
1/ user logs in and views their profile (profile.php)
2/ user edits email address
3/ user clicks 'save profile'
4/ the site sends an email address confirmation message to the user's new email address with a confirmation link
5/ the user email address is changed only when the user clicks the confirmation link within x hours; if no confirmation is received then the old email address remains valid
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Check out cms:cloak_url tag - https://docs.couchcms.com/tags-reference/cloak_url.html
Update the email field when user visits that link.

When user changes email in the form, send email with the cloaked link. The new email address can be stored in a separate editable, in a cookie or in the cloaked link (use cms:add_querystring).
Wow, smart and creative! Yeah will definitely look into that and report on my whereabouts here. Thanks!
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
I have the functionality working. Thanks Trendoman, for your valuable suggestion. It was quite easy to do, in fact.

What I did is, as soon as someone changes their e-mail address I save the new e-mail address in a template field, as suggested by Trendoman. At the same time I send them an email with a cloaked url, again as suggested by Trendoman. The cloaked url points to a confirmation.php page. All that page does is, first check if the person is logged in (if not the user must first login), then read the changed email address from the changed email address template field and update it in table couch_users (field email), then updates it in table couch_data_text (extended field extended_user_email) and finally clears the changed email address template field.

The fact that extended_user_email field had to be changed too was not something I realised immediately, but if you do not update that field then the old email address will reappear in the profile after the next profile update... This puzzled me for a while. But finally, all good, all working !
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Thanks for the feedback :)
5 posts Page 1 of 1
cron