In some circumstances, the Admin would like to give the ability to users to have two Custom Profile Fields for First Name and Last Name and convert the native Joomla single name field into two (2) fields.
You can easily convert this into two (2) fields so that it would become:
Creating the Fields
To do this, you will need to create two (2) special fields in JomSocial Custom Profile Fields.
- Navigate to site back End.
- From the Components dropdown menu, select JomSocial.
- Then select Custom Profiles.
- Click New to create the new field.
The first field created will be the First Name field. This field must be a type of Textbox. The title of the field can be set to anything, but the field code, FIELD_GIVENNAME, must be input exactly as shown in the image below:
The second field follows the same naming convention, only this time we will use the field code, FIELD_FAMILYNAME, as shown in the image below:
There are additional options that may not seem logical, but they need to be respected because the special fields are being created to override the way Joomla manages the name field. These fields are Special Fields and do not follow the logic of the standard custom fields; therefore, you will need to follow these rules to make them work properly:
- Set the fields to NOT show on registration - We are overriding the Name Field in the first registration step which is solely handled by Joomla, so this setting will not be applied to the first registration step. If you set it to show on registration, then you will have same fields in the first and second registration steps.
- Set the fields to NOT be required - Once again, we are overriding the first, Joomla native registration step and, once again, this setting does not appear to make much sense; however, later on, if the user edits the profile and tries to leave these fields empty, the last entry stored in the database will still be used.
- Set the fields to be published - Naturally, if you want the fields to be used, you will need to publish them.
- The other available settings can be used in the same manner as with standard Custom Profile Fields.