Permalink
Browse files

Don't attempt to add responses for users that don't exist

  • Loading branch information...
aolley committed Feb 24, 2013
1 parent 9a378af commit 5f8279a5774ddc57355c41b5c6a3b7640253af67
Showing with 5 additions and 4 deletions.
  1. +5 −4 tab_responses.php
View
@@ -70,10 +70,11 @@ function block_poll_get_response_checks($options, $selected) {
$table->width = '*';
foreach ($responses as $response) {
- $user = $DB->get_record('user', array('id' => $response->userid), user_picture::fields());
- $table->data[] = array_merge(array($OUTPUT->user_picture($user, array($cid)),
- fullname($user), userdate($response->submitted)),
- block_poll_get_response_checks($options, $response->optionid));
+ if ($user = $DB->get_record('user', array('id' => $response->userid), user_picture::fields())) {
+ $table->data[] = array_merge(array($OUTPUT->user_picture($user, array($cid)),
+ fullname($user), userdate($response->submitted)),
+ block_poll_get_response_checks($options, $response->optionid));
+ }
}
echo html_writer::table($table);

0 comments on commit 5f8279a

Please sign in to comment.