Jump directly to Project Overview

(This is for version 0.8.0.3) To increase usability for casual users I would like to make them land automatically on the Project Overview page after login if the company they belong to has only a single active project (thus skipping the dashboard which for these users is unnecessary).

I've managed (hopefully) to identify that an additional piece of code should go into application/controllers/AccessController.class.php into the function login(), probably into this section:

        if ($ref_controller && $ref_action) {
          $this->redirectTo($ref_controller, $ref_action, $ref_params);
        } else {
          $this->redirectTo('dashboard');
        } // if

Unfortunately I am too limited to figure out the correct code - in pseudo-code I imagine something like this working:

        if ($ref_controller && $ref_action) {
          $this->redirectTo($ref_controller, $ref_action, $ref_params);
        } else {

              // start pseudo code
              $project = $user->getActiveProjects;
              if ($project == 1) {
                            $this->redirect('overview', 'project=$project');           
              } else  {
              // end pseudo code
                            $this->redirectTo('dashboard');
              }
        } // if

I am struggling both with PHP syntax and PP-specific functions & variables, but am willing to learn. I would appreciate it very much if some kind soul could point me into the right direction.

Thanks to a rainy day I've figured out a solution - posting it here for reference.

Change this bit in the function login in application/controllers/AccessController.class.php from:

if ($ref_controller && $ref_action) {
          $this->redirectTo($ref_controller, $ref_action, $ref_params);
} else {
          $this->redirectTo('dashboard');
} // if

to this:

if ($ref_controller && $ref_action) {
        $this->redirectTo($ref_controller, $ref_action, $ref_params);
} else {
        if (count($user->getActiveProjects()) == 1){
                $this->redirectTo('project', 'overview', $ref_params);
        } else {
                $this->redirectTo('dashboard');
        } // if
} // if