I’m struggling to find adequate documentation to show how to save data back to an existing user profile that has been extended with ClassExtender. BobRay’s documentation seems to reference new users, not how to deal with existing users.
I have a snippet that gets the profile of the current user:
Found the fix - should have done this from the start, but I’m a newbie to ClassExtender. I took a look at BobRay’s ExtUserUpdateProfile snippet, and he has it all there.
For those watching at home, this is the code I started my snippet with that retrieved the extended data from the user profile:
Normally I would run $user->save(); however, it’s $data that contains the extended info, and is attached to both the ext_user_data and modx_users tables. So where I was trying save to $user, that was the failure. So, the simple solution:
$data->set('key', $value);
$data->save();
Thanks for this package @bobray - very elegant solution
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.