public static function exists($id, $active = true)
{
$id = (int) $id;
$active = (bool) $active;
// get db
$db = BackendModel::getContainer()->get('database');
// if the user should also be active, there should be at least one row to return true
if ($active) {
return (bool) $db->getVar('SELECT 1
FROM users AS i
WHERE i.id = ? AND i.deleted = ?
LIMIT 1', array($id, 'N'));
}
// fallback, this doesn't take the active nor deleted status in account
return (bool) $db->getVar('SELECT 1
FROM users AS i
WHERE i.id = ?
LIMIT 1', array($id));
}