Skip to content

Instantly share code, notes, and snippets.

@otang
Created June 11, 2013 17:01
Show Gist options
  • Save otang/5758634 to your computer and use it in GitHub Desktop.
Save otang/5758634 to your computer and use it in GitHub Desktop.
function get_user($where, $ignore = array('email', 'password', 'ip_address', 'fb_id')) {
if($where) $this->db->where($where);
$this->db->limit(1);
$query = $this->db->get('users');
if($query->num_rows() > 0) {
$user = $query->row();
// Unset some private data that should not leave our database
if(is_array($ignore) && count($ignore)) {
foreach($ignore as $i) {
if(isset($user->$i)) unset($user->$i);
}
}
return $user;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment