Switch to allow moodle version using userid instead of username for calendar access
Minor cleanups, fix php error