Creating a custom profile field

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.


Field as displayed when registering

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



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s