You have mentioned that the user's choice of layout is stored in database. You can use that information right after login and override the default layout in the application component.
Code snippet of login action could be something like this:
....
if ($model->load(Yii::$app->request->post()) && $model->login()) {
//you can use Yii::$app->user->id and get the corresponding layout info
//using something like below, assuming UserLayouts as the model
//corresponding to the table storing user's layout choice
$layout = UserLayouts::find()->where(['user_id' => Yii::$app->user->id])->one();
Yii::$app->layout = $layout->id; //you should fetch the field which is the name of the layout file
//redirect to landing page for member
...
}
This would set the layout for the particular user for all controllers for that particular session, so you would not have to pass the layout info in the URL. Please note this approach will work only if you are not overriding the layout property in each Controller.
This is what Nitin P has also suggested. Only difference is he is suggesting to set $this->layout = "layout_name"
, which I believe will set the layout for that particular controller only and not all controllers. From Yii2 Guide (http://www.yiiframework.com/doc-2.0/guide-structure-views.html#using-layouts):
You may use a different layout by configuring either yii\base\Application::$layout
or yii\base\Controller::$layout
. The former governs the layout used by all controllers, while the latter overrides the former for individual controllers.
I don't have enough reputation to comment on his answer, so I added new answer.