I have a custom profile plugin to extend user profile data. I want to add a switch to hide all BUT the core group of fields when the user checks and edits their profile. In my plugin (profileabc.php) file, within the function I have the following:

public function onContentPrepareForm(Form $form, $data)
    // Check we are manipulating a valid form.
    $name = $form->getName();
    $limit_pw = $this->params->get('limit_pw', 0);

    if ($limit_pw) 
        $fsets = $form->getFieldsets();
        foreach ($fsets as $fgroup) 
            if ($fgroup !== 'core') 

        // do nothing regarding the custom profile data
        return true;
    } ....

This works brilliantly except, the custom fields group/s remain exposed and accessible. Any guidance appreciated. Cheers.

1 Answer 1


I don't think it's safe to remove field groups based on fieldset names. They are unrelated and could be named differently, leading to unexpected results. And that is exactly the issue you're running into. The fieldsets of Custom Fields are named fields-0, fields-1 and so on based number of custom field groups (the ones you can create in backend). Meanwhile, the form field group is com_fields. So you have to remove this group manually:


Or find a way to get the names of all field groups instead of fieldsets.

  • Thanks for this, works a treat. Cheers. Jan 28, 2022 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.