public static function get($id)
{
// redefine
$id = (int) $id;
// get db
$db = BackendModel::getContainer()->get('database');
// get general user data
$user = (array) $db->getRecord('SELECT i.id, i.email, i.password, i.active
FROM users AS i
WHERE i.id = ?', array($id));
// Don't add a settings element, just return an empty array here if no user is found.
if (empty($user)) {
return array();
}
// get user-settings
$user['settings'] = (array) $db->getPairs('SELECT s.name, s.value
FROM users_settings AS s
WHERE s.user_id = ?', array($id));
// loop settings and unserialize them
foreach ($user['settings'] as &$value) {
$value = unserialize($value);
}
// return
return $user;
}