I needed a custom profile field for the site registration form – when users register themselves. The field had to contain a short declaration by the user saying that they agree to keep the information supplied current, etc.
Below is an example of the message with the checkbox the user needs to click, to show that they agree to the terms.
I did this by creating a copy of the profile field type ‘checkbox’ and adding in a little custom html to the field.class.php file.
The custom html gets added using the form addElement code.
$checkbox = $mform->addElement(‘html’, ‘<p>HAD YOUR HTML CODE HERE</p>’);
The screenshot below shows the new profile field, with the code in place