2

I understand this isn't possible from the Control Panel, I'm developing a custom plugin for this specific client project. Essentially these user groups won't need access to the Control Panelat all, but will have unique permissions within the site and will have a few custom fields.

Can I create custom fields per user group? Or do I just need to create relationships between these fields and the users when they create their profile? Trying to figure out the proper way to go about this.

EDIT: After watching the Element Type hangout as suggested, they explain why this isn't possible with the current implementation of User Groups, if you are curious. https://youtu.be/hU_wduMEimY?t=27m44s

  • Looking through the hooks documentation it doesn't seem like this functionality is supplied by default... maybe I'm missing something or thinking about this the wrong way. – Paul Kirby Jun 19 '17 at 19:18
1

You could control which fields a user has access to based on their group from a front end edit profile page, but there is no way to do this in the admin outside of creating a plugin with a custom table and screens.

  • I am considering both options. I was digging through the default database to see how Craft relates users to their profile fields, but am having a hard time seeing how they create that relationship. I'm considering creating a custom plugin, but I would want to use crafts built in functionality to relate the users to the table entries. Do you have any knowledge on that? – Paul Kirby Jun 19 '17 at 20:49
  • When setting up the plugin table you would create a userId field and then you would use foreign key "relationships" in the record to the link the user to the table. I would probably put all the field sin the same table and then just limit what fields the user can edit in UI based on the user's group. Its complicated you'll have to get into the docs and even look up some sample code to get a feel for how to set up a plugin. – SublymeRick Jun 19 '17 at 21:05
  • There is a way to use the field layout stuff with your custom plugin but I dont have experience with that. There is a 3 part video from a few years ago where they go over it. I would recommend watching that hangout, a few times. – SublymeRick Jun 19 '17 at 21:07
  • straightupcraft.com/events/… – SublymeRick Jun 19 '17 at 21:10
  • Thanks a lot! Its sound like what your suggesting in your first comment would essentially be the same thing I would do if I used the included profile fields with craft core, but it would also allow me to hide those specific fields in the CP, which I don't really need. I suppose the easiest route is to just create all necessary fields in the profile, and limit which ones they can submit in the front end based on what type of user they are trying to create. – Paul Kirby Jun 19 '17 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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