CodeIgniter Forums
Registering User and assigning roles through Admin - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Registering User and assigning roles through Admin (/showthread.php?tid=78838)



Registering User and assigning roles through Admin - daemont00ls - 03-16-2021

Greetings! i'm fairly new to PHP, myth/auth, and CI. Just started like 3 days ago.  
I wanted to know how i can register a user  and assign them roles as an admin. Basically, i create the accounts and not the users themselves. I can successfully register a user as an admin but i'm stuck on how i can push data from a list of roles to the register method in AuthController so i can specifically add that user to the roles. Reading through the documentation of Myth/auth, i can add it with "withGroup" method. but im not sure how i can pass data from <select> tag to the register method.


RE: Registering User and assigning roles through Admin - daemont00ls - 03-16-2021

Found a way but i dont know if it is the best solution, although it works. I got the post request of the <select> tag and passed that to the withGroup method.