Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Add a capability to control which users get emailed when a certificate is issued #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,15 @@
)
),

'mod/certificate:email' => array(

'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),

);
1 change: 1 addition & 0 deletions lang/en/certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$string['borderstyle_help'] = 'The Border Image option allows you to choose a border image from the certificate/pix/borders folder. Select the border image that you want around the certificate edges or select no border.';
$string['certificate'] = 'Verification for certificate code:';
$string['certificate:addinstance'] = 'Add a certificate instance';
$string['certificate:email'] = 'Be emailed when a student receives a certificate';
$string['certificate:manage'] = 'Manage a certificate instance';
$string['certificate:printteacher'] = 'Be listed as a teacher on the certificate if the print teacher setting is on';
$string['certificate:student'] = 'Retrieve a certificate';
Expand Down
2 changes: 1 addition & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function certificate_get_teachers($certificate, $user, $course, $cm) {
global $USER;

$context = context_module::instance($cm->id);
$potteachers = get_users_by_capability($context, 'mod/certificate:manage',
$potteachers = get_users_by_capability($context, 'mod/certificate:email',
'', '', '', '', '', '', false, false);
if (empty($potteachers)) {
return array();
Expand Down