Answers.Body: <p>This should be easy to do w/ the upcoming Craft 4.0 release, via <a href="https://github.com/craftcms/cms/pull/10300" rel="nofollow noreferrer">conditional fields</a>.</p>
  <p>For Craft 3.x, the cleanest solution is probably to hide the relevant fields with CSS. Combining the <a href="https://plugins.craftcms.com/cp-body-classes" rel="nofollow noreferrer">CP Body Classes</a> and <a href="https://plugins.craftcms.com/cp-css" rel="nofollow noreferrer">CP CSS</a> plugin should make this fairly simple.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-07T12:54:55.080Z
Answers.LastActivityDate: 2022-03-07T12:54:55.080Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I'm trying to make some fields unavailable for a certain user group when they create or edit a new entry. These fields should only be available to admin users.
  I had implemented this by extending the craft\services\Fields class and using the getFieldsByLayoutId method, checking the user and unsetting the fields which should not be available for the specific user group.
  This used to work but after some craftcms updates it seems to break the application.
  Any ideas on how I should approach this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-07T11:11:34.057Z
Comments.Text: Did you find it? I'm facing exact the same problem.
Comments.UserDisplayName: Seb van Dijk
Tags: <plugin-development><craft3><field><user-groups>
Title: Removing or hiding certain fields from the CP new entry for a specific user group
ThreadText: # Removing or hiding certain fields from the CP new entry for a specific user group
  
  (Asked by: username_0 on 2021-04-19)
  
  I'm trying to make some fields unavailable for a certain user group when they create or edit a new entry. These fields should only be available to admin users.
  I had implemented this by extending the craft\services\Fields class and using the getFieldsByLayoutId method, checking the user and unsetting the fields which should not be available for the specific user group.
  This used to work but after some craftcms updates it seems to break the application.
  Any ideas on how I should approach this?
  
  **Tags:** plugin-development, craft3, field, user-groups
  
  > **Comments:**
  > **username_1**: Did you find it? I'm facing exact the same problem.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-03-07. Score: 1
  
  This should be easy to do w/ the upcoming Craft 4.0 release, via [conditional fields](https://github.com/craftcms/cms/pull/10300).
  
  For Craft 3.x, the cleanest solution is probably to hide the relevant fields with CSS. Combining the [CP Body Classes](https://plugins.craftcms.com/cp-body-classes) and [CP CSS](https://plugins.craftcms.com/cp-css) plugin should make this fairly simple.
  
  
  ---
  
  