2

I have a plugin that does a little work after a user has been saved in the CP based on the user groups they are in.

The $event->params['user'] object seems to be partially up to date when the event is handled. The username and general info is the recently entered values, however the groups is not current, it is always what is was before

4
  • I did a little extra digging, if I kill the function that is handling the onSaveUser event and check the database the craft_usergroups_user table is showing the 'old' values, not the values that were just posted. Aug 26 '14 at 21:18
  • 1
    There is a known issue regarding the $_POST['groups'] value, and the order in which it's processed. This answer from another question addresses a slightly different situation, but may help you solve your problem.
    – Lindsey D
    Aug 26 '14 at 23:12
  • Thanks @LindseyD. I ended up checking the groups array in the post to see if the correct value was there $groups = craft()->request->getPost('groups'); Sep 5 '14 at 13:51
  • I'm voting to close this question as off-topic because it sounds like a bug that you hit and you aren't posing a specific question. Feel free to clarify if this isn't the case.
    – Anna_MediaGirl
    Feb 20 '15 at 1:05