How to- make phone field required at registration.
by John on Nov.06, 2009, under Hints/Tips/Hacks
Some users may need to have the phone number field required for new registrations. This is quite simple and needs you to edit 2 files on your server. Address.php which is located in your classes folder, and also the authentication.tpl file wich is located in your theme folder.
First the Address.php file. Find the the following line of code:
protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city');
and change it to:
protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city', 'phone');
In the authentication.tpl file find the following code:
<p class="text">
<label for="phone">{l s='Home phone'}
<input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
</p>
and change it to:
<p class="required text">
<label for="phone">{l s='Home phone'}
<input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
<sup>*</sup>
</p>
This second section of code adds the astrix to show that the field is required.
You could use the above example to make any of the fields required in your registration process. Just look for the different sections in the authentication.tpl file and add the <sup>*</sup>.
Related posts:


