CERTIFICATE - Need to print User City

CERTIFICATE - Need to print User City

by gd info -
Number of replies: 10

Hi, I need to print USER CITY on certificate.  My problem is how to get value from USER record. I actually use ver. 3.0 of the module but I consider to upgrade to 4.3.

Thanks in advance.

Average of ratings: Useful (1)
In reply to gd info

Re: CERTIFICATE - Need to print User City

by Tom Cox -
Me too. I posted some time ago and got no help. I need to pull data from the extra user fields, but have had no luck yet. Anyone? Thanks, Tom
Average of ratings: Useful (1)
In reply to Tom Cox

Re: CERTIFICATE - Need to print User City

by Vikram Solia -
hi Tom!

Which version of Moodle are you using? Are you prepared to edit the PHP files at your server as this will require some change in code.
Average of ratings: Useful (1)
In reply to Vikram Solia

Re: CERTIFICATE - Need to print User City

by gd info -

Hi Vikram,

I'm using 1.7.1 version and absolutely prepared to change some code.

Thanks in advance.

In reply to Vikram Solia

Re: CERTIFICATE - Need to print User City

by Tom Cox -
We use 1.7 and 1.8. We also use the "fat" version of the cert. Thanks, Tom
In reply to Tom Cox

Re: CERTIFICATE - Need to print User City

by Vikram Solia -
hi Tom and gd!

You will need to add another line in following file where <moodlefolder> is to be replaced by your moodle folder. Please keep a backup copy of the files you modify before attempting this.

<moodlefolder>/mod/certificate/type/unicode_landscape/certificate.php

you should find code similar to this towards the end of the file:
cert_printtext(170, 230, 'C', 'FreeSerif', 'I', 30, $studentname);
Below this line, you need to paste a similar line (the original line remains - don't modify it) with $USER->city instead of student name. You will also need to change 170 and 230 with something sensible which are the x and y coordinates on the resulting certificate where the output will take place. 'C' stands for center, 'FreeSerif' is the name of the font, 'I' is italics and '30' is the size.

Please look up (only look up, nothing requires to be changed) the definition of the function cert_printtext in the file <moodlefolder>/mod/certificate/lib.php which explains the various arguments.

This should do the trick.
Average of ratings: Useful (1)
In reply to Vikram Solia

Re: CERTIFICATE - Need to print User City

by Tom Cox -

Thanks Vikram,

It worked great!

Tom

In reply to gd info

Re: CERTIFICATE - Need to print User City

by José de Jesús -
Paz y Bien.
Gd. and Tom:
You do not worry,  you have 6 attempts allowed in the practices of the examination. I recommend unloadings to you the manuals of the professor and of the administrator, I also am learning, in fact I need much that to learn.
José de Jesús