Hi guys,
Further to my last questions, I'm taking this a little further and maybe for good reason...
Would this be a good way (or hack) of doing the same thing too? I don't know if there are many other weird cross referenced tables there needed for the permissions so I'm not 100% sure this is a good idea.
SELECT * FROM modx_member_groups, modx_membergroup_names WHERE user_group = modx_membergroup_names.id AND
modx_member_groups.member = 1
The reason I ask, is that as I'm building an application, and I want to be able to use the a <select>, <option> dropdown in html and have the correct user group for the ids, and have those match up with the fields that are being edited by the user, so the correct records are stored with the correct credentials so the correct users can see only the records associated with them.
I know it must sound complicated, but I get these results with the current query as above.
id,user_group,member,role,rank,id,name,description,parent,rank,dashboard
10,1,1,2,0,1,Administrator,NULL,0,0,1
12,8,1,1,0,8,"Business Sample 1","This is for business 1",0,0,1
So basically this is what I'm looking to output eventually: eg.
<select id="usergroups">
<option value="1">Adminstrator</option>
<option value="8">Business...</option>
</select>
The current built-in api functions don't seem to have this built in... and it's either one or the other - not combined?
What I'm scared of doing is using an array feature with getUserGroups and getUserGroupNames and storing them such as
Userdata_name[0] = "Admin"
Userdata_number[0] ="1"
Userdata_name[1] = "Business..."
Userdata_number[1] "8"
and not have them come out in the same correct order where maybe the 8 and the 1 get swapped or similar (especially when there are more than 2 groups).
Are these fair questions, or am I going about this the wrong way?
Thanks again. -Steve