Fix invite code deletion
When I experimented I found that invite codes could be reused over and over. That seemed strange to me, and when I looked at the code I saw that was not the intended behavior... this change fixes a broken DB statement and allows the codes to be deleted once used.