Could very well be. Don’t see any problems with the delete itself and the error is talking about ‘add or update’. The session isn’t invalidated and also not verified on loading a page. Looking at the code, it is probably trying to add a veteran medal, because null < strtotime(‘-1 year’).
Downside is that ?deleted is exactly the place where it tries to add the medal before even getting to the ?deleted part. It’s perhaps nicer to split the logout function in the user class so you have an invalidate_session function and use that function either in the delete function itself or after the call to it.
Is fairly important. I’ve added it to the script things are happily destroyed now. @dloser was right that the problem was with the medal being added rather than being deleted, as you were still logged in but with no user details the medal script got confused and tried to award you medals for no reason.