I'm trying to use a form to assign a user to a different user group, so besides saving to its own corresponding table, it has to save data to the #__user_usergroup_map table.
I read the tutorial for CFv3 and it said you could choose multiple tables in the same db connection, but in CFv4 that's not possible, so my guess is I have to add 2 db saves so I did just that.
The db save for the form's table works fine but the db save for the user groups table doesn't get updated.
I turned on the debugging option of Joomla and got an interesting result: the query created by the db save action was "SET user_id WHERE group_id = '9'", which is clearly the opposite of what it should be and the reason why no record is found. Then I checked the database in PHPMyAdmin and I found that both fields are marked as one single primary key. (they appear like grouped together, hope that makes sense)
Using a query in PHPMyAdmin does work, just in case. So my guess is the problem comes when CF tries to identify the primary key for the record.
So, the question is, obviously, how could I make the db save work here?
David
I read the tutorial for CFv3 and it said you could choose multiple tables in the same db connection, but in CFv4 that's not possible, so my guess is I have to add 2 db saves so I did just that.
The db save for the form's table works fine but the db save for the user groups table doesn't get updated.
I turned on the debugging option of Joomla and got an interesting result: the query created by the db save action was "SET user_id WHERE group_id = '9'", which is clearly the opposite of what it should be and the reason why no record is found. Then I checked the database in PHPMyAdmin and I found that both fields are marked as one single primary key. (they appear like grouped together, hope that makes sense)
Using a query in PHPMyAdmin does work, just in case. So my guess is the problem comes when CF tries to identify the primary key for the record.
So, the question is, obviously, how could I make the db save work here?
David