Merge branch 'MDL-77086-master' of https://github.com/sarjona/moodle

This commit is contained in:
Paul Holden 2023-02-15 16:21:48 +00:00
commit 9074c28699
2 changed files with 13 additions and 1 deletions

View File

@ -228,8 +228,19 @@ class backpack_api2p1 {
$msg['status'] = \core\output\notification::NOTIFY_SUCCESS;
$msg['message'] = get_string('addedtobackpack', 'badges');
} else {
$statuserror = $response->status->error;
if (is_array($statuserror)) {
// Although the specification defines that status error is a string, some providers, like Badgr, are wrongly
// returning an array. It has been reported, but adding this extra check doesn't hurt, just in case.
$statuserror = implode($statuserror);
}
$data = [
'badgename' => $data['assertion']['badge']['name'],
'error' => $statuserror,
];
$msg['status'] = \core\output\notification::NOTIFY_ERROR;
$msg['message'] = get_string('backpackexporterror', 'badges', $data['assertion']['badge']['name']);
$msg['message'] = get_string('backpackexporterrorwithinfo', 'badges', $data);
}
return $msg;
}

View File

@ -129,6 +129,7 @@ $string['backpackemailverifypending'] = 'A verification email has been sent to <
$string['backpackemailverifysuccess'] = 'Thanks for verifying your email address. You are now connected to your backpack.';
$string['backpackemailverifytokenmismatch'] = 'The token in the link you clicked does not match the stored token. Make sure you clicked the link in most recent email you received.';
$string['backpackexporterror'] = 'Can\'t export the badge to backpack';
$string['backpackexporterrorwithinfo'] = 'Can\'t export the badge "{$a->badgename}" to backpack. Error: {$a->error}';
$string['backpackimport'] = 'Badge import settings';
$string['backpackimport_help'] = 'After the backpack connection is successfully established, badges from your backpack can be displayed on your badges page and your profile page.