public static function get_user_logged_in_admin() { if (isset($_SESSION['user'])) { $user_id = $_SESSION['user']; $user = User::findOneUser($user_id); if ($user->getAdmin()) { return true; } else { return false; } } return null; }
public static function updateUser($id) { $user = User::findOneUser($id); if ($user->getAdmin() == TRUE) { Redirect::to('/users', array('message' => 'Admin rights cannot be revoked.')); } else { $user->makeAdmin(); $user->updateUser($id); Redirect::to('/users', array('message' => 'Chosen user has been promoted to an admin status.')); } }