Email notification template variables

Email notification template variables

by Paul Vincent -
Number of replies: 3

Hi,

I've been looking to alter the email notifications that go out to our teaching staff, so that a direct link to the students' submissions is included, rather than just a link to the Assignment page. To do this, I need access to the student user id to construct the notice (e.g. https://vle.oca.ac.uk/mod/assign/view.php?id=608&rownum=0&action=grader&userid=9), but can't work out where and how these variables are made accessible to the editable language files in moodle admin. I'm also hoping this can be done through theme file overrides rather than requiring changes to core...?


Many thanks in advance

Paul



Average of ratings: -
In reply to Paul Vincent

Re: Email notification template variables

by Paul Vincent -
Sorry to bump this with my own reply, but I'm really struggling to find how to do this. The default email notice for new assign submissions provides the variables {$a->username} and {$a->assignment}, with the latter being the assignment title/name. I want to change this notice so I can provide a direct link to the submission in need of grading, which requires access to the user id and the assignment id.

In assign/locallib.php at approx. 6560, the notification is called, but I can't work out how to provide that language string with access to those other two variables. Can anyone please help with pointers?

Many thanks,
Paul
In reply to Paul Vincent

Re: Email notification template variables

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Have you considered using the Grade Me block? It already does what you are wanting to do, take you directly to a users assignment that needs grading. If you have to create your own code/changes, you might be able to find how it is done in the Grade Me code.

I have the Grade Me block set up on my site home page, with it set to Display throughout the entire site. This makes it so that when I log in, I can see everything that needs grading, in every course. When I click to go grade any item, the block is visible while grading so that I can quickly go to the next student.
In reply to AL Rachels

Re: Email notification template variables

by Paul Vincent -
Thanks AL; I hadn't been aware of that block; many thanks for that, it's certainly a useful addition! However the need for notifications is due to a lot of our tutors being sessional, and managing students via an asynchronous open enrolment model, so we don't expect them to be checking the VLE every day, only when a new submission has been made. I might be able to create an event-driven local plugin from the code in that block if I have to, but I'd hoped there was a simple means of modifying a file to just slightly alter the variables being passed to the existing notification. I'll keep digging in those assig files, but I now have a good fallback plan if that doesn't bear fruit! 😊