User profile change

Hello,

I’m making profile change but I have problem. When submit the form, it updates all my columns, not just this, who are in the form.

In the form I just have email, but it updates username, password, etc.

That’s my Profile action


	public function actionProfile()

	{

		$id = (Yii::app()->user->isAdmin() and is_numeric($_GET['id'])) ? $_GET['id'] : Yii::app()->user->id;

		$user=$this->loadUser($id);

		if(isset($_POST['User']))

		{

			$user->setAttributes($_POST['User']);

			//print_r($user->getAttributes()); 

			//$user->attributes=$_POST['User'];

			if(isset($_POST['submitUser']) && $user->save())

				Yii::app ()->user->setFlash ( 'user', 'Успешно променихте профила!' );

		}

		$this->render('profile',array('user'=>$user));

	}



The second parameter to save is a list of attributes you want to save - http://www.yiiframework.com/doc/api/CActiveRecord#save-detail

So if you want to save only the email you can use


$user->save(true,array('email'));

Wow, thank you and sorry that I’m not looking…