- if ($poll instanceof Poll and $scoped instanceof Profile) {
- $response = $poll->getResponse($scoped);
- if ($response instanceof Poll_response) {
- // User has already responded; show the results.
+ if ($poll instanceof Poll) {
+ if (!$scoped instanceof Profile || $poll->getResponse($scoped) instanceof Poll_response) {
+ // Either the user is not logged in or it has already responded; show the results.