How to restore/add previous user account

#1 Back up your data!
#2 Add the user with the exact same username as before.
#3 You should have all your settings and files back.

Alternative for geeks:

#1 Backup Backup Backup your data!
#2 Add this line to then end of /etc/passwd (replace [username] with your username, replace 1700 with your previous userid, and replace 1701 with your previous groupid - if you don't know your userid and groupid, then set both to 1700):

[username]::1700:1701::/home/[username]:/bin/bash

Try logging into the console (CTRL-ALT-F1) as [username] with no password. Then run passwd and enter a new password. You should then be able to log in as before.

If you can't find your old userid and groupid, then you'll likely have some file permissions problems, and you'll need to log in as another user and run this command

 sudo chown -R [username]:[username] /home/[username]

to restore permissions.