diff --git a/mod/choice/lib.php b/mod/choice/lib.php
index abb885f83e9..b0217f4493b 100644
--- a/mod/choice/lib.php
+++ b/mod/choice/lib.php
@@ -224,6 +224,11 @@ function choice_show_form($choice, $user, $cm) {
echo "id\" />";
if (!isguest()) { //don't show save button if the logged in user is the guest user.
echo "";
+
+ if ($choice->allowupdate && $aaa = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user->id)) {
+ echo "
".get_string("removemychoice","choice")."";
+ }
+
} else {
print_string('havetologin', 'choice');
}
diff --git a/mod/choice/view.php b/mod/choice/view.php
index f047d52f6db..ba734978b93 100644
--- a/mod/choice/view.php
+++ b/mod/choice/view.php
@@ -28,6 +28,12 @@
print_error('badcontext');
}
+if ($action == 'delchoice') {
+ if ($answer = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id)) {
+ //print_object($answer);
+ delete_records('choice_answers', 'id', $answer->id);
+ }
+}
/// Submit any new data if there is any