I want to enhance the user registration form. I want to add a drop-down menu to show usergroups. I already have created a plugin for this and the drop-down is showing.
I have used an XML file to load the usergroup field. However I don't want to show all usergroups.
How can I determine which usergroup are shown in the drop-down box?
Furthermore the value from this standard form usergroup is not saved. How can I save the chosen usergroup?
This is the code:
public function onContentPrepareForm($form, $data)
{
if ($form->getName() != 'com_users.registration') {
return;
}
$form->loadFile(dirname(FILE) . '/forms/form.xml');
}
and this is the form field in the XML file:
<field name="guest_usergroup" type="usergroup" label="klas" description="klass" multiple="true" />