Add set_user_prefs function

Also add prefs insertion on login if user doesn't have an entry in the
prefs table