Skip to content

Instantly share code, notes, and snippets.

@meotimdihia
Created April 10, 2012 13:39
Show Gist options
  • Save meotimdihia/2351444 to your computer and use it in GitHub Desktop.
Save meotimdihia/2351444 to your computer and use it in GitHub Desktop.
<?php
#Put `AppUsersController.php` in `app/Controller`
App::uses('UsersController', 'Users.Controller');
class AppUsersController extends UsersController {
public function beforeFilter()
{
parent::beforeFilter();
$this->User = ClassRegistry::init('AppUser'); #require AppUser.php in Model
}
protected function _getMailInstance($config = 'default')
{
App::uses('CakeEmail', 'Network/Email');
return new CakeEmail($config);
}
public function render($file = null, $layout = null)
{
if (!file_exists(APP . 'View' . DS . 'Users' . DS . $this->action . '.ctp')) {
$file = App::pluginPath('Users') . 'View' . DS . 'Users' . DS . $this->action . '.ctp';
} else {
$file = APP . 'View' . DS . 'Users' . DS . $this->action . '.ctp';
}
return parent::render($file, $layout);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment