The better question would be, IMHO: "Is it possible to export a student's attempt at a quiz including answers, feedback and marks to a PDF file that clearly states critical attempt information (student name, datetime of attempt, grade and export datetime, ...) at the top of each page?"
colleague.
Well, perhaps. But what if a student, instead of "printing" their quiz, simply strokes through it, and does a copy and paste into a word document? The watermark would not appear, or even if it does, the student could delete it.
For example, if I print this moodle page to a PDF, your profile picture would be in it. But if I swipe through your post, then copy/paste it, your profile photo doesn't show, or I could delete it, like so:
In reply to Rick Jerz
Re: Adding Watermark to quiz page.
by Akosah Dennis - Friday, June 23, 2023, 4:38 PM
It will help me check for students who will decide to write the quiz for their
colleague.
I'm not sure I understand what you mean by a watermark on the quiz question page. Please could you explain a bit better.
Maybe you want student names to be displayed when they take a quiz and maybe increase the size of student photo as shown below, which you can achieve with the following script. See Where to place the JavaScript code➚ on dynamiccourseware.org for where to put it.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <script> $(document).ready(function() { var dcnamestudent = $(".logininfo a:eq(0)").text(); $(".navbar.fixed-top").prepend('<div style="position:fixed; top: -3px; right:290px; color:#ccc; z-index:10; font-size: 40px;"><b>'+dcnamestudent+'</b></div>'); $(".userpicture").attr("width","120"); $(".userpicture").attr("height","120"); $(".userpicture").css({"position":"relative","top":"33px"}); }); </script>
where you might want to adjust the top and right positions.
Here is what it looks like:
See https://dynamiccourseware.org/course/view.php?id=144§ion=3➚ for more details.
Perhaps Akosah can provide us with a mockup of what is desired.
Here's an interesting thing, Dominique. In my Moodle 3.11, I have the student's name showing to the left of the profile photo. In Moodle 4.2, I cannot figure out how to do this. I found some comments about the name being removed in Moodle 4. But I don't know.
So, I take note of your script.
I was going to suggest to Akosah that the student's name already shows (as in your picture). But again, Moodle 4.2 doesn't show it.
In the past, people wanted to show the name for face-to-face courses, so the instructor could walk around during the quiz (in class) and observe the student's name. However, It appears that Akosah might be talking about a printed pdf version of the quiz being passed on to other students. Akosah will have to clarify.
Mary, do you recall anything about M3.11 showing both name and picture (see graphic). In M3.11, I have both the name and picture shows, but I can't seem to do this in M4.2. Was this a change in Moodle core?

You are right! We can see the photo, small or large, and the name of the student in the quiz Navigation block (you have to set "Appearance / Show the user's picture" of the quiz settings to "Small image" or "Large image"). The student's name is small, providing some privacy, but still visible from a certain distance. However, the block drawer must be open to see the block.
If we set "Extra restrictions on attempts / Browser security" of the quiz settings to "Full screen pop-up with some JavaScript security", the quiz Navigation block is always visible, although it slides to the bottom of the page on small screens.
However, the OP's request was about a watermark. We still don't know for sure what exactly he meant. A watermark is often placed diagonally across the page. Is that what he was talking about?
Quiz navigation block with large image and student's name (standard settings):
Quiz page with watermark(?):
$(".navbar.fixed-top").prepend('<div style="position:fixed; top: 250px; right: 300px; color: rgba(100, 100, 100, 0.2); background-color: transparent; font-size: 120px; transform: rotate(-30deg);"><b>'+dcnamestudent+'</b></div>');
This is what I was talking about.i,e the second picture. (Quiz with water mark?) But can you explain further how it done.
Thanks.
Hello Rick,
"... people wanted to show the name for face-to-face courses, so the instructor could walk around during the quiz (in class) and observe the student's name."
Exactly, and that's what I had already done in my own course where I teach. I thought that's what Akosah might want.
Although not necessarily displayed, the student's name is available at the bottom of every page, under $("body #page-wrapper #page #page-footer .footer-content-popover .footer-section:eq(1) .logininfo .logininfo a:eq(0)"), with the mention "You are logged in as John Doe".
My script is simple. It retrieves the student's name available under .logininfo, and displays it at the top of the page. You can display it during the quizzes, but also on all the pages of a course if you wish.
I think the option to display the student's name in large letters at the top of the page could be useful to many teachers for the reason you mentioned, and imho maybe Moodle should offer it as a core option.
I also hope that Akosah will clarify what he wanted.
Best
Randomize questions and multiple choice answer options
Randomly pull questions from the question bank to populate a participant's quiz
Use Safe Exam Browser to lock down the workstation while a participant takes a quiz
(Consider proctoring, but I'd rather you opted for not doing that... yikes on privacy and academic ethics issues)
And: even if you'd watermark the pages a participant printed to a PDF, what would you do if they'd just use their phone's camera for screenshots instead?
This is what I was talking about.i,e the second picture. (Quiz with water mark?) But please can you explain further how it done.
Thanks.
Sure.
For Moodle 4.x:
- To watermark a single quiz, place the code below in a "Text..." block in the Quiz, and set "Display on page types" to "Attempt quiz page".
- To watermark all quizzes in a course, place the code below in a "Text..." block on a main Course page, and set "Display on page types" to "Any page".
- To watermark all quizzes in all courses on a Moodle site, place the code below in "Site administration / Appearance / Additional HTML".
See JavaScript solution➚ and Where to place the JavaScript code➚ on dynamiccourseware.org for more details.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <script> $(document).ready(function() { var dcnamestudent = $(".logininfo a:eq(0)").text(); $(".navbar.fixed-top").prepend('<div style="position:fixed; top: 250px; right: 300px; color: rgba(100, 100, 100, 0.2); background-color: transparent; font-size: 120px; transform: rotate(-30deg);"><b>'+dcnamestudent+'</b></div>'); }); </script>
please the first two options didn't work for me.
The third worked somehow but I find it difficult to scroll and clicking or selecting a section or option is also difficult. Please help me out
Perhaps you want to give a class name on the element containing student's name, e.g.: "watermark", then add in below in the Raw SCSS (search this on Site Administration):
pointer-events: none;
}
This should fix the scrolling issue. Hope that helps.
- K -
Please how do i go about this, i am a little bit lost