if (
$isBanned
&& $isChanged
&& $user->user_state == 'moderated'
&& !$this->end_date
)
{
// User has been permanently banned while awaiting approval, so make them valid so they
// don't appear on the approval list any longer. Don't use rejected as an unban would require
// 2 steps then.
$user->user_state = 'valid';
}