custom certificate- how to display the Username field?

custom certificate- how to display the Username field?

av IQBAL Musthapa -
Antal svar: 4

Hi everyone

been searching high and low; how do I insert the username field into my custom cert output? 



Genomsnitt av betyg: -
Som svar till IQBAL Musthapa

Re: custom certificate- how to display the Username field?

av Mark Nelson -
Bild på Core developers Bild på Documentation writers Bild på Particularly helpful Moodlers Bild på Peer reviewers Bild på Plugin developers Bild på Testers

Unfortunately this can only be done by a developer.

You would need to create another element (see mod/customcert/element) and have it display the username, it wouldn't be too hard to do.


Som svar till Mark Nelson

Re: custom certificate- how to display the Username field?

av Aaron Cauchi -

Hi, can you be a bid more elaborate as to quote "(see mod/customcert/element)"? how can I access via moodle this section? Need to insert the username in the certificate

Thanks


Aaron Cauchi

Som svar till IQBAL Musthapa

Re: custom certificate- how to display the Username field?

av Henry Endara -
You can add the username field in the list of the user fields.
You need edit file /mod/customcert/element/userfield/classes/element.php , in this file you add username field in array $userfields.
For example after 'idnumber' you can add 'username'
you need add following line
'username' => get_user_field_name('username'),
So the complete array is
$userfields = array(
'firstname' => get_user_field_name('firstname'),
'lastname' => get_user_field_name('lastname'),
'email' => get_user_field_name('email'),
'city' => get_user_field_name('city'),
'country' => get_user_field_name('country'),
'url' => get_user_field_name('url'),
'icq' => get_user_field_name('icq'),
'skype' => get_user_field_name('skype'),
'aim' => get_user_field_name('aim'),
'yahoo' => get_user_field_name('yahoo'),
'msn' => get_user_field_name('msn'),
'idnumber' => get_user_field_name('idnumber'),
'username' => get_user_field_name('username'),
'institution' => get_user_field_name('institution'),
'department' => get_user_field_name('department'),
'phone1' => get_user_field_name('phone1'),
'phone2' => get_user_field_name('phone2'),
'address' => get_user_field_name('address')
);