This content has been marked as final. Show 3 replies
Or do I have to write a custom login module?
I think that this should work:
select userroles, 'Roles' from userroles where roles_id in (select roles_id from cmtuser_role where cmtuser_id in (select user_id from users where username = ?))
The innermost subselect queries the user ids for a username (can be only one or zero), the outer subselect queries the role ids for this user id, and for those role ids the role names are queried.
Hope that the statement reflects your table structure ;-).
sorry, I forgot to write.
select title, 'Roles' from role where id in (select roles_id from cmtuser_role where cmtuser_id in (select id from cmtuser where username = ?))
for my db-structure. Thank you very very much for your hint; it was very important for me to find the solution. :-)