validation code is
return array(
array('firstname, lastname, confirm_email, education, email, password, occupation,location , birthdate, interest,gender,created, modified', 'required'),
array('email', 'email'),
array('password', 'length', 'max'=>20, 'min' => 5,'message' => "Incorrect fi (length between 5 and 20 characters)."),
array('firstname', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => UserModule::t("Incorrect symbols (A-z0-9).")),
array('email', 'unique'),
);
You may make your email unique in yii user model by the following rule as given in below.
public function rules() {
return array(
...
array('email', 'email'),
array('email', 'unique', 'className' => 'User',
'attributeName' => 'email',
'message'=>'This Email is already in use'),
...
); }
Here className is the name of your user model class, attributeName is your db email field name.
You may also check the below link.
http://www.yiiframework.com/forum/index.php/topic/32786-creating-my-own-model-cmodel-not-cactiverecord/
Thanks
public function rules()
{
return array(
...
array('email', 'email'),
array('email', 'unique'),
...
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With