Remove Message when starting and submitting a quiz

Remove Message when starting and submitting a quiz

by Simon A -
Number of replies: 12
Hello,

I was wondering if it's possible to remove the message you get in moodle when you start and submit a quiz.

The first message says: This quiz has a time limit and is limited to 1 attempt(s). You are about to start a new attempt. Do you wish to proceed?

The second message says: You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.

I'm using Moodle Version 1.9.1+

Any help is most appreciated

Simon

Average of ratings: Useful (1)
In reply to Simon A

Re: Remove Message when starting and submitting a quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
First message comes from view.php. You will see that around line 400 it creates a variable called $strconfirmstartattempt. Just reset that to an empty string after it has been initialised - insert something like
// LOCAL CUSTOMISATION starts
 // Remove JavaScript pop-up warning when staring an attempt
 $strconfirmstartattempt = '';
// LOCAL CUSTOMISATION ends

Before the line

 // Determine the URL to use.


The second message comes from attempt.php, about 50 lines from the end. Again there is a variable, this time $strconfirmattempt, that you need to set back to being an empty string after it has been initialised.

In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Simon A -
Thankyou very much. It works now



In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Tieku Bortei-Doku -

Tim,

This is kind of related. how can i change the wording "Submit all and finish" to "Submit all and finish (click once)"

Tieku

In reply to Tieku Bortei-Doku

Re: Remove Message when starting and submitting a quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can customise all of the user-interface text in Moodle by going to Admin -> Langauge -> Language editing. The docs are here: http://docs.moodle.org/en/Language_editing
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Tieku Bortei-Doku -
Thank you very much. I have learned something new that will be very helpful.
In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Nicole Guagliardi -

Hi Tim!

I'd also like to remove these two popups, but I'm using version 2.0 and while I found the variable $strconfirmstartattempt (in accessrules.php) I can't find $strconfirmattempt.  Could you point me in the right direction?

Thanks!

Nicole

In reply to Nicole Guagliardi

Re: Remove Message when starting and submitting a quiz

by Alan Kmiecik -
In Moodle 2.3.2 (Build: 20120910): Go to attemptlib.php in mod/quiz Around line 343 change: public function confirm_start_attempt_message($unfinished) { if ($unfinished) { return ''; } if ($this->quiz->timelimit && $this->quiz->attempts) { return get_string('confirmstartattempttimelimit', 'quiz', $this->quiz->attempts); } else if ($this->quiz->timelimit) { return get_string('confirmstarttimelimit', 'quiz'); } else if ($this->quiz->attempts) { return get_string('confirmstartattemptlimit', 'quiz', $this->quiz->attempts); } return ''; } Change to: public function confirm_start_attempt_message($unfinished) { if ($unfinished) { return ''; } return ''; } Your deleting the following from the file if ($this->quiz->timelimit && $this->quiz->attempts) { return get_string('confirmstartattempttimelimit', 'quiz', $this->quiz->attempts); } else if ($this->quiz->timelimit) { return get_string('confirmstarttimelimit', 'quiz'); } else if ($this->quiz->attempts) { return get_string('confirmstartattemptlimit', 'quiz', $this->quiz->attempts); }
In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Miguel Fabo -

Hello guys! I also want to remove that.

I tracked that message and the only file which contains that string is moodle/mod/quiz/renderer.php. I'm working on moodle 2.6.11. Does any of you know how to remove it?

$button = new single_button(
                new moodle_url($attemptobj->processattempt_url(), $options),
                get_string('submitallandfinish', 'quiz'));
        $button->id = 'responseform';
        if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {
            $button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null,
                    get_string('submitallandfinish', 'quiz')));
        }

Thanks in advance!

In reply to Miguel Fabo

Re: Remove Message when starting and submitting a quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Probably the minimal change is to modify

 if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {

to

 if (false && $attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {

(Bold bit inserted.)

In reply to Tim Hunt

Re: Remove Message when starting and submitting a quiz

by Miguel Fabo -

Oh Tim, that was impressive. Thank you very much, it worked like a charm! Thanks again.

In reply to Miguel Fabo

Re: Remove Message when starting and submitting a quiz

by Inter Jos -

Hi,


I Too want o get rid of the pop up boxes but changes as in the renderer.php file as desribed in t he last post ' if (false && $attemptobj->get_state() == quiz_attempt::IN_PROGRESS) { ' doesn't work for me. I am using moodle 2.9.1+

where can I change it?


Thanks.

jose