Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

by Ellen Reisinger -
Number of replies: 4

Hi, 

Was wondering if someone could help me. I'm would like to know what I can put into the local customisation that will effectively prevent the Title string (which defaults to "Certificate of Achievement") from being included (printed/displayed) on the certificate?

I've tried to think of as many search terms as possible to find the solution, but can't seem to find this requirement cited by anyone else. Perhaps I'm going about it the wrong way?

Average of ratings: -
In reply to Ellen Reisinger

Re: Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

by Jean-Michel Védrine -

Hello Helen

There are several ways to achieve this

My preferred one would be to create a customized certificate type

Duplicate the certificate type subfolder in mod/certificate type you like the most (for instance let's say it's "A4_embedded") and give it a new name (for instance "beautiful_certificate")

Open the mod/certificate/type/beautiful_certificate/certificate.php and search a line with get_string('title', 'certificate') in it and delete that line. 

Save the modified file

That's all now when you choose beautiful_certificate when you create or edit a certificate, it doesn't have the "CERTIFICATE of ACHIEVEMENT" text printed on it

The only drawback of this method is that you must have access to the files on your Moodle server to do that

Another way to achieve the same thing would be to go to Site Administration -> Language -> Language customization and open the English language pack (or whatever language you use), press "Continue" and select "mod" and "certificate.php" in the "Show strings of these components" in the list and enter "title" in the "string identifier" field.

Then there is a little problem because you must enter something in the right column, you can't enter nothing or simply a space because Moodle will consider that you haven't changed anything and will not save your change. So enter some text you want to be printed on the certificate instead of "CERTIFICATE of ACHIEVEMENT"

Click on the "Save change to the language pack" button and confirm you want to make this customization.

The drawbacks of this method are

  • You must have administrative access to your Moodle
  • The change will be  made for all certificates on the website
  • You must replace the sentence by something else, you can't simply suppress it
A third method, but I don't recommend this method at all is to open the mod/certificate/lang/en/certificate.php file and replace the line
$string['title'] = 'CERTIFICATE of ACHIEVEMENT';
with simply
$string['title'] = '';
and save your change
The drawbacks of this method are:
  • you must have access to the files on your Moodle server
  • The change will be  made for all certificates on the website
  • This method only works for the English language (the files for other languages are in another place and changes would be overwritten by the next upgrade to languages packs
  • But the major drawback in my opinion is that the next time you upgrade your certificate module, your change will be lost !!

In reply to Jean-Michel Védrine

Re: Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

by Ellen Reisinger -

Hi Jean-Michel, 

Thank you for the information. Whilst we don't have direct access to the Server files, we own the system and have implemented option 1.   It works super well.

However, can I clarify a couple of things in relation to this change:

1. When we need to next upgrade the Certificate Plugin, will this over write the 'beautiful_certificate' folder? And if it doesn't with any fixes/upgrades made to the main certificate.php will our new certificate.php in 'beautiful_certificate' folder become a static copy of the old code?

2. We have four specific border designs - 2 landscape and 2 portrait - that we want to use in conjunction with the removal of the String 'Certificate of Achievement'. When a user selects from Type, 'beautiful_certificate', can we filter the border images so that they can only choose the ones we want them to use with in conjunction with this new certificate Type?

3.  Can we also apply permissions so that only certain users get access to this 'beautiful_certificate' and it's associated images?  Just thinking along the lines of how we can prevent other Departments/users from having access to create certificates using images, logos, etc that don't belong to them.

Thank you again for your time.



In reply to Ellen Reisinger

Re: Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

by Jean-Michel Védrine -

Hello Ellen,

  1. When you will upgrade you Moodle or your certificate module, your "beautiful_certificate" folder will not be overwritten, unless of course if during the upgrade you delete the certificate folder before uploading the new files. This is in fact how I upgrade my Moodle (at least once a year for Moodle itself, more frequently for plugins and if I find a bug I absolutely need fixed then I make an "unscheduled upgrade"): I delete all files  and upload the new Moodle and all plugins files then I re-upload all my customizations, for instance my customized certificates. This way I avoid any "leftover" from the previous versions.
    Yes as "beautiful_certificate" is untouched during upgrade, it become a static copy of the old certificate type it was based upon when it was created. This is not a big problem as certificates types are rarely updated. For instance if we look at the history of the mod/certificate/type/A4_embedded/certificate.php, we see that the latest important change was done 26 Jul 2013, so it's usually quite easy to look at these changes and do the same on your customized certificate types.
  2. No this is not possible, it would require some changes in the certificate code. But there is a workaround:
    • Create a copy of "beautiful certificate" folder one for each of your design and change its name so that your user can recognize which certificate type is the one they want to use
    • In each certificate type, change the line certificate_print_image($pdf, $certificate, CERT_IMAGE_BORDER, $brdrx, $brdry, $brdrw, $brdrh); to something like
      $pdf->Image("$CFG->dirroot/mod/certificate/pix/borders/Fancy1-blue.jpg", $brdrx, $brdry, $brdrw, $brdrh);
      of course you need to replace Fancy1-blue.jpg by the image you want to use
    • Warn your users that their borders choice in the drop down menu when creating a new certificate will have no effect and that borders will be fixed for each certificate type
    • If needed you can use the same trick for watermark, seal or signature
    • This trick can also be used to print images that are not in the usual directories for the certificate module so that these images will no be visible in the drop down menus displayed in the form when creating certificates.
  3. This would be a very useful feature IMHO. One way to do it would be if Mark Nelson is OK to decide that each certificate type is a real subplugin of the certificate plugin, this way we could install, uninstall certificate types more easily and also we could use capacities to allow or disallow user access to each certificate type as we do for other functionalities in Moodle.
    This would also permit each certificate type to have it's language string, so it would solve CONTRIB-4089
    This is quite a big change, so it should be carefully prepared (and all certificate users would have to upgrade their customized certificate types !! so most probably a lot of them would not be happy sad  )
    in the meantime I see no easy way to do it.
In reply to Jean-Michel Védrine

Re: Language Pack Title string "CERTIFICATE OF ACHIEVEMENT" blank out

by Ellen Reisinger -

Thank you  Jean-Michel, especially for your detailed responses. 

In relation to point 1., I now have a better understanding about upgrade practices. Now I just need to mesh that with what happens in our environment (tho we are extremely fortunate to have an awesome server management group).

With regard to point 2. I will definitely consider this as an implementation option. We only wish to offer four standardised certificates, and other than orientation & border the code would be the same for all four. so even the initial overheads for setting up the individual certificate.php types would be minimal. However I do have an additional question, regarding Date which I will post as a new question. 

3. I will be interested to see if anyone else has the same  requirement. From our perspective, along with internal divisions, we allow other Departments to use our Moodle instance, so this would be invaluable.

Thank you again for sharing your knowledge.