I get a lot of bounced emails with people registering with things like "
[email protected]" or "
[email protected]." Simple typos. It'd be nice to make them enter their email twice and verify it's the same. This would cut down on registration mistakes. I did a search for this but didn't find anything.
Easy enough to do...
In Themes/default/Register.template.php
Find
// Are they allowed to hide their email?
if ($context['allow_hide_email'])
echo '
<input type="checkbox" name="hideEmail" class="check" id="hideEmail" /> <label for="hideEmail">', $txt[721], '</label>';
echo '
</td>
</tr><tr>
Add after
<td width="40%">
<b>Verify ', $txt[69], ':</b>
<div class="smalltext">This is just to make sure you didn\'t mis-type your email address...</div>
</td>
<td>
<input type="text" name="email2" size="30" />
</td>
</tr><tr>
In Sources/Register.php
Find:
if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);
Add after:
if (empty($_POST['email2']) || $_POST['email2'] != $_POST['email'])
fatal_lang_error('Email addresses aren\'t the same.', false);
That should do it.
Thank you very much!
Also note that people can go back and change their email address....
-[Unknown]
A nice little addition there, been added on my forum, thanks Oldiesmann.
Thanks. I'm getting a load of members who apparently can't type their email address correctly...
Hi all,
I've tried to add this but when I test it out I get the following error at the top of the page:
QuoteNotice: Undefined index: Email addresses aren't the same. in /home/tauonli/public_html/forums/Sources/Errors.php on line 233
And the 'An Error Has Occurred!' box has nothing in it...any help?
Find:
fatal_lang_error('Email addresses aren\'t the same.', false);
Replace:
fatal_error('Email addresses aren\'t the same.', false);
-[Unknown]
Quote from: [Unknown] on August 30, 2004, 02:51:45 PM
Find:
fatal_lang_error('Email addresses aren\'t the same.', false);
Replace:
fatal_error('Email addresses aren\'t the same.', false);
-[Unknown]
Thanks :)
is this included in 1.1 beta 3 ?
if not, how can we do it?
Great solution Oldiesmann, nice trouble-shooting [Unknown] ! 8)
Implemented it right away!
@elmacik, You can check if it's inlcuded, by taking a look at the registration-procedure at this very board? If it isn't you could take a look at the files an see if they look the same as what Oldiesmann posted? If it is, it probably works the same as well?
Greetz!
Anakin
Quote from: [Unknown] on August 25, 2004, 11:43:55 PM
Also note that people can go back and change their email address....
-[Unknown]
even if email activation is required, and theyre not activated?
didnt work for 1.1 beta 3
This is simple to install and a good idea. Works fine on 1.0.5. :)
work in 1.1 RC1?
Can't find
if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);
In Sources/Register.php of 1.1 rc1
Quote from: houston on November 17, 2005, 10:16:35 PM
Can't find
if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);
In Sources/Register.php of 1.1 rc1
neither could i. but i went about it a different way
In Themes/default/Register.template.php
Find:
// Are they allowed to hide their email?
if ($context['allow_hide_email'])
echo '
<input type="checkbox" name="hideEmail" class="check" id="hideEmail" /> <label for="hideEmail">', $txt[721], '</label>';
echo '
</td>
</tr><tr>
Add After:
<td width="40%">
<b>Verify ', $txt[69], ':</b>
<div class="smalltext">This is just to make sure you didn\'t mis-type your email address...</div>
</td>
<td>
<input type="text" name="email2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
Note: I added the tabindex so when people are registering and just tabing though the fields it doesnt get missed.
Find:
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
}
Replace With:
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value && document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The E-Mail Address you have entered to not Match. The Passwords You have Entered do not Match. Please Check them again to make sure they are correct.");
return false;
}
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
}
if (document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The E-Mail Address you have Entered are NOT the same. Please Check them to make sure they are correct");
return false;
}';
that is how i was able to get it working
i do not know were $txt['register_passwords_differ_js'] is. i thought it would be in errors.english.php but it is not. if you know were it is. please tell me and you can add your alert there using
alert("', $txt['register_emails_differ_js'], '");
and
alert("', $txt['register_passwords_emails_differ_js'], '");
Thanks so much for this. I get the same problem that you guys have encountered. Member send me emails or post threads saying they can't log in because they never receieved an activation email. =_=
Quotei do not know were $txt['register_passwords_differ_js'] is. i thought it would be in errors.english.php but it is not. if you know were it is. please tell me and you can add your alert there using
alert("', $txt['register_emails_differ_js'], '");
and
alert("', $txt['register_passwords_emails_differ_js'], '");
SleePy, you can find $txt['register_passwords_differ_js'] in
Login.english.php located in
Themes/default/languages/.
Although it seems just adding the alerts creates a parsing error. I may have tossed them into login.english.php wrong.
You are getting parse errors because there is a little omission in Sleepy's code. The code as he posted it here perhaps may have worked in his version and config, but I am getting parse error in 1.1.6 too. So, here is how to fix it.
a) There needs to be a semicolon after }.
b) Watch out for the tick at the end of the code. The tick at the end of the code is just the closing tick for the echo statement.
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function verifyAgree()
{
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
};
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value && document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The e-mail addresses you have entered to NOT match. The passwords You have entered do not match. Please check them again to make sure they are correct.");
return false;
};
if (document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The e-mail address you have entered are NOT the same. Please check them to make sure they are correct");
return false;
}';
In case you are getting parse errors when implementing this functionality, check the red code in your code. SleePy's code is missing the semicolons.
By the way, there is a module called EmailValidator. This mod nicely comliments this functionality. Check it out here: http://custom.simplemachines.org/mods/index.php?mod=1353
-------------
www.maxi-pedia.com - Maxi-Pedia: Your resource for finance & IT!
www.finance-management.cz - Central European Center for Finance and Management
This is nice, thanks
Do anyone know how to force users to must enter birthdate and location during registration ?
Do you still need help with this kirderf?
How can I do this to SMF 1.1.9?
Thanks
this is not happening in 1.1.10, kindly help
Do you still need help with this raghhav?
yes please.
This would be so nice to add to 2.0 RC2