but doesn't cms's like wordpress remove users from the db ? i think that would be a better way to go surely?
I guess it depends. For one, I just gave an answer in a single line of code. It may not be the best way, but it works. Sites like facebook never truly delete your profile because the data is valuable. Also, database space is cheap until you get into hundreds of thousands of users.
Here are the things to consider.
If you truly delete the profile, what do you want to delete? Do you also want to delete their bio? What if you created a forum with userspice. Does it delete their posts? What if someone replied to that post? What if there is a link on the post where you click the username and that user has been deleted? Does that give you a 404 error?
The thing with UserSpice is that I never know what someone is going to actually do with the framework, so I try not to make features that have unintended consequences. Anyone is welcome to mod the system to go around and delete the user, bio, permissions, and all content. It's super easy.
If you're interested in doing that, just write a bunch of queries in a row that attach to the $user->data()id
For the profile you would delete WHERE user_id = $user->data()id and so on. It's not hard. Just think of the consequences if someone tries to access that data.
So for the bio
So @mudmin I create a php file with that code and link it to a button?
@firestorm I'm actually using Bootstrap for the frontend so I wouldn't know.
Sure. You can essentially make a form with a button and then if that button was clicked, it would run that query that I gave you. If you are deleting the account, you might want to change the message from banned to deactivated in the us_helpers.php