Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
See function oa_teams_remove_member($team, $uid), oa_teams.module line 166
$wrapper->{OA_TEAM_USERS_FIELD}->set($users);
$wrapper->save();
If $users is an empty array, this will cause an exception in profiles/openatrium/contrib/entity/includes/entity.wrapper.inc, line 122.
Including error handling, I believe lines 166 and 167 should be changed to:
try {
if (empty($users)) {
$wrapper->{OA_TEAM_USERS_FIELD}[0]->set(NULL);
} else {
$wrapper->{OA_TEAM_USERS_FIELD}->set($users);
}
$wrapper->save();
} catch (EntityMetadataWrapperException $exc) {
// error handling
}
I opened the bug against 2.19, which is where I'm seeing this, but the code is the same in latest.
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedThe actual problem here is that the Users field of a Team is a *required* field in Drupal, so Drupal doesn't allow it to be empty. Just wrapping it with the exception handler doesn't change that issue. The correct way to fix this will be to make the users list optional, which I'll look into.
Comment #2
mpotter CreditAttribution: mpotter commentedCommitted fix to 38fedbb. Will require reverting the oa_teams feature to change the required setting on the field.