If a user has profile any fields in a category called 'account', then executing the add roles action causes them to be unset.

This is because workflow_ng_action_user_addrole() calls user_save() without setting the third argument. As a result this argument defaults to 'account', which effectively says that the update contains updates to the equivalent profile area, although it doesn't. When profile_save_profile() gets called as a side effect of the user_save() call, it extracts the profile fields from the edit argument, but as they are not present gets empty values, which it then stores in the DB.

The solution is simple: change line 210 from:

user_save($user, array('roles' => $user->roles));

to

user_save($user, array('roles' => $user->roles), null);

Comments

fago’s picture

Version: 5.x-2.1 » 5.x-2.x-dev
Status: Active » Fixed

ok, I've fixed that. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.