I have this code to save a new user onto a userfield on another user:
$employees = $currentUser->employees->ids();
$employees[] = $employee->id;
$currentUser->getContent()->setAttributes(['employees' => $employees]);
if (!craft()->users->saveUser($currentUser))
{
Craft::dd($currentUser->getErrors());
}
Which works fine, however if there's a pending user in the employees field it's not returned in the ids() array. How do I get all user ids from the employees field, not just active users?
Edit: got it:
$employees = $currentUser->employees->status('*')->ids();