Everytime the student or the admin clicks on the VIEW CERTIFICATE button as in below screenshot, an email with certificate is sent to the certificate recipent.
however it should send the email only once, when the student/user first time clicks on the view button and the other times it should only display the certificate
It should only send the certificate once. It seems those users are just blank records? Do you have the contents of the database table mdl_customcert_issues?
Everytime the student or the admin clicks on the VIEW CERTIFICATE button as in below screenshot, an email with certificate is sent to the certificate recipent.
however it should send the email only once, when the student/user first time clicks on the view button and the other times it should only display the certificate