frontend/controllers/UserController.php
public function actionProfile() {

		// Find Model
		$user = Yii::$app->core->getUser();

		// Avatar
		$avatar = File::loadFile( $user->avatar, 'Avatar' );

		// Scenario
		$user->setScenario( 'profile' );

		if( $user->load( Yii::$app->request->post(), $user->getClassName() ) && $user->validate() ) {

			// Update User
			$this->modelService->update( $user, [ 'avatar' => $avatar ] );

			// Refresh Page
			return $this->refresh();
		}

		$genderMap = $this->optionService->getIdNameMapByCategorySlug( CoreGlobal::CATEGORY_GENDER, [ 'prepend' => [ [ 'id' => '0', 'name' => 'Choose Gender' ] ] ] );

		return $this->render( CoreGlobalWeb::PAGE_PROFILE, [
			'user' => $user,
			'avatar' => $avatar,
			'genderMap' => $genderMap
		]);
	}
public function actionProfile() {

		// Find Model
		$user = Yii::$app->core->getUser();

		// Avatar
		$avatar = File::loadFile( $user->avatar, 'Avatar' );

		// Scenario
		$user->setScenario( 'profile' );

		if( $user->load( Yii::$app->request->post(), $user->getClassName() ) && $user->validate() ) {

			// Update User
			$this->modelService->update( $user, [ 'avatar' => $avatar ] );

			// Refresh Page
			return $this->refresh();
		}

		$genderMap = $this->optionService->getIdNameMapByCategorySlug( CoreGlobal::CATEGORY_GENDER, [ 'prepend' => [ [ 'id' => '0', 'name' => 'Choose Gender' ] ] ] );

		return $this->render( CoreGlobalWeb::PAGE_PROFILE, [
			'user' => $user,
			'avatar' => $avatar,
			'genderMap' => $genderMap
		]);
	}
public function actionProfile ( ) { // Find Model $ user = Yii :: $ app -> core -> getUser ( ) ; // Avatar $ avatar = File :: loadFile ( $ user -> avatar , 'Avatar' ) ; // Scenario $ user -> setScenario ( 'profile' ) ; if ( $ user -> load ( Yii :: $ app -> request -> post ( ) , $ user -> getClassName ( ) ) && $ user -> validate ( ) ) { // Update User $ this -> modelService -> update ( $ user , [ 'avatar' => $ avatar ] ) ; // Refresh Page return $ this -> refresh ( ) ; } $ genderMap = $ this -> optionService -> getIdNameMapByCategorySlug ( CoreGlobal :: CATEGORY_GENDER , [ 'prepend' => [ [ 'id' => '0' , 'name' => 'Choose Gender' ] ] ] ) ; return $ this -> render ( CoreGlobalWeb :: PAGE_PROFILE , [ 'user' => $ user , 'avatar' => $ avatar , 'genderMap' => $ genderMap ] ) ; }
The action profile allows users to update their profile.

@return string
The action profile allows users to update their profile .