hi, my register function used to work, I spent some time tweaking something in the UserIdentity class, when I got back registering a test account, it doesn’t save nor send email anymore, I don’t really know what’s wrong as the yii log nor php logs doesn’t tell any error at all, it simply doesn’t work…but the validations are alright?
public function actionRegister()
{
$form = new Wsmembers;
if(isset($_POST['Wsmembers']))
{
$form->attributes = $_POST['Wsmembers'];
if($form->validate())
{
$pass = sha1($_POST['Wsmembers']['LoginPassword']);
$form->EmailAddress = $_POST['Wsmembers']['EmailAddress'];
$form->LoginName = $_POST['Wsmembers']['LoginName'];
$form->LoginPassword = $pass;
$form->MembershipContactName = $_POST['Wsmembers']['MembershipContactName'];
$form->MembershipSecretQuestion = $_POST['Wsmembers']['MembershipSecretQuestion'];
$form->MembershipSecretAnswer = $_POST['Wsmembers']['MembershipSecretAnswer'];
$form->MembershipDateSetup = new CDbExpression('NOW()');
$form->save();
if($form->save()){
Yii::app()->user->setFlash('success','Thank you for joining!,Please check your email and activate your account');
$to = $_POST['Wsmembers']['EmailAddress'];
$subject = "Welcome To BuggyMan!";
$message = "Thank you for joining!, we have sent you a separate email that contains your activation link";
$from = "FROM: buggyman@gmail.com";
mail($to,$subject,$message,$from);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: buggy man <tesmail@gmail.com>' . "\r\n";
$subject2 = "Your Activation Link";
$message2 = "<html><body>Please click this below to activate your membership<br />".
Yii::app()->createAbsoluteUrl('wsmembers/activate', array('email' => $_POST['Wsmembers']['EmailAddress'])).
"</body></html>";
mail($to, $subject2, $message2, $headers);
}
$this->redirect($this->createUrl('register', array('r'=>'wsmembers/register')));
}
}
$this->render('register', array('form' => $form));
can you help me spot the not ? the culprit that prevents it to save the data and send email? … i tested the default contact page and it actually sends email