Get PIN field from user profile

This commit is contained in:
Kumi 2021-11-24 16:29:16 +01:00
parent 599adda141
commit 0b97efcbd5

View file

@ -25,6 +25,7 @@
namespace mod_htmlcert;
require_once(__DIR__ . "/../vendor/autoload.php");
require_once($CFG->dirroot.'/user/profile/lib.php');
use mikehaertl\wkhtmlto\Pdf;
@ -117,6 +118,8 @@ class template {
$user = \core_user::get_user($userid);
}
profile_load_data($user);
$htmlcert = $DB->get_record('htmlcert', ['templateid' => $this->id]);
$pdf = new Pdf(array(
@ -173,7 +176,7 @@ class template {
$html = str_replace("__DATE__", userdate($date, '%B %d, %Y'), $html);
$html = str_replace("__PIN__", $user->profile["pin"], $html);
$html = str_replace("__PIN__", $user->profile_field_pin, $html);
$pdf->addPage($html);
$pdf->send();