Prevent update of custom user profile meta field on the front end after 1st entry
I have an e-learning website that issues an official certificate of completion when a students complete their training course. The user profile name on the account can be used as the student name when generating the certificate, but if the user updates their profile name it also updates the name on the certificate. This is a problem since it would allow a user to complete a course once and then update their user profile name multiple times to generate official certificates for several other people(without completing the training or paying for it).
I created a set of custom user meta fields for the student name that are only exposed on the back end and I changed the certificate setup so that it uses these custom meta fields to add the student name to the certificate. The custom meta field remains blank if I don’t manually update it on the back end, but I want the user to be able to enter this information on the front end for themselves once and then prevent any future updates from the front end (only allow me to make approved updates on the back end).
How do I expose a custom user meta input field on the front end user profile page only if it is empty and then hide it if it’s not null?