Timeline for Is there a way for a user to assign another user to a group on the frontend?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 7, 2022 at 19:18 | comment | added | Keatyn Garton | I appreciate this so much, exactly what I was looking for! Thank you! | |
Mar 7, 2022 at 19:17 | vote | accept | Keatyn Garton | ||
Mar 7, 2022 at 9:45 | comment | added | MoritzLost | Thanks for the research – good to know! | |
Mar 7, 2022 at 9:41 | history | edited | Mats Mikkel Rummelhoff | CC BY-SA 4.0 |
added 147 characters in body
|
Mar 7, 2022 at 9:39 | comment | added | Mats Mikkel Rummelhoff | I'll make a note that the above only works when editing existing users and not when registering new ones, though – an important caveat :) | |
Mar 7, 2022 at 9:39 | comment | added | Mats Mikkel Rummelhoff |
@MoritzLost I did test it and it works. Maybe the reason why it's not mentioned in the docs is that assigning groups via users/save-user only works conditonally, specifically if the request is not a "public registration" – see github.com/craftcms/cms/blob/develop/src/controllers/…. In the case where the form is used to edit existing users' profiles (which is how I interpreted the OP) $isPublicRegistration should always be false , and hence assigning user groups should work.
|
|
Mar 7, 2022 at 8:41 | comment | added | MoritzLost |
Great answer! Are you sure that users/save-user supports setting user groups though? It's not listed as a supported parameter in the documentation – but maybe it's just missing?
|
|
Mar 7, 2022 at 0:59 | history | edited | Mats Mikkel Rummelhoff | CC BY-SA 4.0 |
added 19 characters in body
|
Mar 7, 2022 at 0:53 | history | edited | Mats Mikkel Rummelhoff | CC BY-SA 4.0 |
added 19 characters in body
|
Mar 6, 2022 at 20:54 | history | edited | Mats Mikkel Rummelhoff | CC BY-SA 4.0 |
added 100 characters in body
|
Mar 6, 2022 at 20:47 | history | answered | Mats Mikkel Rummelhoff | CC BY-SA 4.0 |