Creating user roles and profiles in Codeigniter using Ion Auth

I am using Codeigniter with Ion Auth to manage users. I would like to create two different user roles: one for volunteers and one for organizations. I know that I can use Ion Auth groupsfor things like access control, but that would be a good way to add fields to different types of users (for example, the volunteer user will have a "Languages" field, and the organization will be a "Mission" field) ? Should I extend the Ion Auth class for each new user type and handle the CRUD separately for each type or use the "groups" field and user ID to refer to fields in another table? Any understanding of the approach to this common problem?

+3
source share
2 answers

I had the same problem before, what I did was build relationship tables to handle different groups with different fields. Then I changed the profile () code a bit to join the table of additional relations according to the settings of the user group.

I would start creating a relational database.

Example:

**volunteers table**
id
user_id
languages

**organizations table**
id
user_id
mission

Then, depending on the user group, attach the table to the profile () function.

Hope this helps!

+2
source

I would recommend just adding all the fields you need to the meta table and updating only those that you need for each user group. If you need several groups for each user, select Ion Auth v2 .

+5

All Articles