pass user in function