Skip to content

Instantly share code, notes, and snippets.

@interlock
Created June 12, 2012 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save interlock/2918973 to your computer and use it in GitHub Desktop.
Save interlock/2918973 to your computer and use it in GitHub Desktop.
Get user id
$weather = false;
if ( $this->Session->check('Auth.User.id') ) {
App::uses('User','Model');
$UserModel = new User();
$user = $UserModel->find('first',array('conditions'=>array('User.id'=>$this->Session->read('Auth.User.id')),'contain' => array('FarmleadProfile')));
if ( !empty($user) && !empty($user['FarmleadProfile'])) {
// construct address
$address = 'Saskatoon/SK/Canada';
$weather = $weatherLib->fetchWeather('autoip');
}
} else {
$weather = $weatherLib->fetchWeather('autoip');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment