Best Way To Have Your Login Screen As The Intro Screen

I’m a VERY newbie to YII so please be gentle… I am looking to setup a website so that the first screen that comes up when a user types in the websites URL is the login screen. Once they login and are verified, they then go off to another screen.

The way i currently set it up is in the main.php config file i put this line in:

‘defaultController’=> ‘site/login’,

Then in the SiteController.php file, in the ‘public function actionLogin()’ function, i added this redirect so that the user goes off to the ‘promo’ screen after logged in:

$redirect = $this->redirect(array(‘site/promo’, ‘business’=>$this->$model->businessID));

This all works in that the first screen that comes up is the login screen and the user is then redirected to the promo screen with a variable called ‘business’… unfortunately i can’t seem to populate that variable with a value… Nevertheless, is this the best way to accomplish all of this or is there a better way using beforeAction() of controller or perhaps behaviors???

In your SiteController set:

    public $defaultAction = 'login';

I’m not sure where you are getting businessID from, however I would expect simply:

$this->redirect(array('site/promo', 'business'=>$model->businessID));

thanks… actually it’s using the LoginForm model for the login but the businessID comes from the Users model - so i’m guessing i need to do call to the Users model to get the businessID

In the standard login process through a db, you are loading the User model. In the components/Identity, I think, where they return ERROR_NONE, you can add a $this->setState() call to save the bussinessId to Yii::app()->user.