Log in

View Full Version : Un-Delete A User...


trevelyn1015
06-09-2005, 07:19 PM
one of my admin/moderators deleted a member. i don't want him deleted, as i want members to be able to search for his topics/posts/etc...

how can i undelete the account? or start a new one and make those "guest" posts count as his?

Andreas
06-09-2005, 07:24 PM
You cannot "un-delete" a user.
What you can do: Add a new user with the same name, thed update tables user, userfield und usertextfield with the old userid for this new userid.

trevelyn1015
06-09-2005, 07:35 PM
i don't know the old user number, though...

Andreas
06-09-2005, 07:38 PM
That's bad. But you should find that in the adminlog.
If not:
select userid, username from post where username='deleteduser' group by userid

trevelyn1015
06-09-2005, 07:48 PM
509

that is the member number...

i found it...

how do i make a new user(i already made the new user, which is number 1330) and assign that user id to him and then update them all?

Andreas
06-09-2005, 07:56 PM
Create a new user, note down the userid.

Then
update user set userid = 509 where userid = X
update userfield set userid = 509 where userid = X
update usertextfield set userid = 509 where userid = X

trevelyn1015
06-09-2005, 08:00 PM
it doesn't work...

says that the user does not exist...

Andreas
06-09-2005, 08:02 PM
I've got no idea how this could not work ...
If you want, send me a PM with ACP, phpMyAdmin accounts and the username then I can take a look at it.

trevelyn1015
06-09-2005, 08:05 PM
the account, that was deleted was named:

"D."

and his member number was 509

the new member I created is named:

"D."

the new member number is 1330

i ran:

update user set userid = 509 where userid = 1330

and got this:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'forum2.user' doesn't exist

Andreas
06-09-2005, 08:06 PM
Then you are using a table prefix that must be put in front of user, userfield and usertextfield :)

trevelyn1015
06-09-2005, 08:09 PM
oh...

and what does that mean?

haha

Andreas
06-09-2005, 08:14 PM
That does mean that you have to put your table prefix in front of user, userfield and usertextfield in the queries I posted :)
I don't know what your table prefix is - you must know that as it is your installation.
(Can be found in config.php => $tableprefix)

trevelyn1015
06-09-2005, 08:25 PM
$tableprefix = 'forum2_';

Andreas
06-09-2005, 08:50 PM
Then put forum2_ in front of user, userfield and usertextfield in the queries I posted.

trevelyn1015
06-09-2005, 09:01 PM
ok, i did them all...

and they all worked...

now he is userid 509... but how do i assign all of those "guest" posts to that username?

Andreas
06-09-2005, 09:18 PM
ACP / Import & Maintenance / Update Counters - if the posts still carry his userid
If not you must assign it.

trevelyn1015
06-09-2005, 09:36 PM
yeah, the posts no longer carry his userid...

his name had been deleted...

and i can't do anything to a "guest", can i?

Andreas
06-09-2005, 09:41 PM
Then
update forum2_post set userid=509 where username='D.'

You must also do this for Threads, PMs and Usernotes

trevelyn1015
06-09-2005, 10:07 PM
oohhhhhhh....

you are the man, kirby! :)

khaales
05-06-2008, 01:38 PM
hello Andreas

and tanx for your good guide for this important problem
i has same prob and i do from your posts one by one. now my deleted user is alive again and his posts are linked to his name and user name... but some problem:

1- what do you mean "You must also do this for Threads, PMs and Usernotes"
I put "Threads, PMs and Usernotes" in place of "post" in your last SQL Query but it has error and say the thread have not user name or something like this

2- His number of posts and thanks and thanked and ... is still 0 from wher i can update them. i was update some thing in ACP but not effected!

thank you very much