Change members record to a different group

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
User avatar
bruceholt
Veteran Member
Posts: 100
Joined: 2016-07-30 20:16
Location: Australia

Change members record to a different group

Post by bruceholt » 2020-08-16 07:08

I have been trying to limit the number of records that a user can have in a particular table if they belong to a certain group but in another group they can have more records.

I set the number of records in the hooks file but realised that if I change the user to a different group, the membership_userrecords table says that the record belongs to the previous group.

Is there any way to change this without having to do it one by one which isn't practical?

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Change members record to a different group

Post by angus » 2020-08-19 10:53

Not sure how you assign the groups bruceholt, if you do from the admin pages it should automatically reassign them but if you do this in hooks then maybe this will work, not tried it so use with care?

Code: Select all

$group = $memberInfo[groupID];                                           //Assumes you have already moved the user to the new group?
	 $username = $memberInfo[username];
     sql("UPDATE `membership_userrecords` SET `membership_userrecords`.`groupID` = $group WHERE `membership_userrecords`.`memberID` = '".$username."' ", $eo);
AppGini 22.13

User avatar
bruceholt
Veteran Member
Posts: 100
Joined: 2016-07-30 20:16
Location: Australia

Re: Change members record to a different group

Post by bruceholt » 2020-08-20 07:52

Hi Angus,

Thanks. Which hooks file should I put that in?

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Change members record to a different group

Post by angus » 2020-08-20 20:17

Can I check how you are updating the user from one group to another?
AppGini 22.13

User avatar
bruceholt
Veteran Member
Posts: 100
Joined: 2016-07-30 20:16
Location: Australia

Re: Change members record to a different group

Post by bruceholt » 2020-08-21 05:54

Through admin, Angus.

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Change members record to a different group

Post by angus » 2020-08-21 14:18

from my understanding then Bruce this should be applied automatically after you amend the group
AppGini 22.13

User avatar
bruceholt
Veteran Member
Posts: 100
Joined: 2016-07-30 20:16
Location: Australia

Re: Change members record to a different group

Post by bruceholt » 2020-08-22 02:49

Thanks Angus. From what I can tell, the user records in the table stay as the previous group.

Post Reply