$c seems not to be used in the function
This assignement to $user is dead and can be removed.