Restore a deleted user

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
licht77
Registered User
Posts: 6
Joined: Mon Jan 05, 2015 10:03 am

Restore a deleted user

Post by licht77 »

Hi!
Using 3.3.0 the "auto prone" feature seemed to deleted some users keeping their posts online and moving them to UID 1 (anonymous user).

In old 3.0.x days it was possible to undo that by re-registering a new user and fixing its relation to those 3 tables:

Code: Select all

UPDATE phpbb_posts SET `poster_id` = N WHERE `post_username` = 'the username';
UPDATE phpbb_topics SET `topic_poster` = N WHERE `topic_first_poster_name` = 'the username';
UPDATE phpbb_topics SET `topic_last_poster_id` = N WHERE `topic_last_poster_name` = 'the username';
Today that wont work - tried it, deleted cache and re-ran statistic generation - but the old user still remains inactive (no stats, no link to its profile etc).

What about the actual datamodel... what needs to be fixed today on 3.3.0? Any hints are highly appreciated!
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51459
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Restore a deleted user

Post by stevemaury »

For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
licht77
Registered User
Posts: 6
Joined: Mon Jan 05, 2015 10:03 am

Re: Restore a deleted user

Post by licht77 »

stevemaury wrote:
Sun Aug 02, 2020 11:00 pm
viewtopic.php?f=46&p=14450506
Hi stecemaury, thanks for your effort. Unfortunately, the linked szenario is different to mine, as all posts of the autopruned user were moved to userid 1 / anonymous. So even if i find the old userid somewhere the posts still belong to uid 1.

Still i can identify all relevant posts in the table by "poster_username"... see the first 3 sql statements above.
Nevertheless this does not match all requirements to get that user live again...

any ideas?
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51459
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Restore a deleted user

Post by stevemaury »

I can tell you that the post_username field is only used for Guest posts and is blank where the poster is a registered user. So if you are reassigning posts to your new user (and make sure the Newly registered users group is not enabled when you create the user) another later query should be:

Code: Select all

UPDATE phpbb_posts SET  post_username = '' WHERE poster_id = N ;
(You don't need the backticks (`))
Is your new user in the Registered users group in the user_group table? How are you creating the new user?
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
licht77
Registered User
Posts: 6
Joined: Mon Jan 05, 2015 10:03 am

Re: Restore a deleted user

Post by licht77 »

Thanks stevemauri - that did the job :)

So for all with the same problem:

1. create a new user for the autopruned user (USERNAME)
2. find its new USERID
3. execute these sql statements

Code: Select all

UPDATE phpbb_posts SET poster_id = USERID WHERE post_username = 'USERNAME';
UPDATE phpbb_topics SET topic_poster = USERID WHERE topic_first_poster_name = 'USERNAME';
UPDATE phpbb_topics SET topic_last_poster_id = USERID WHERE topic_last_poster_name = 'USERNAME';
UPDATE phpbb_posts SET  post_username = '' WHERE poster_id = USERID ;
Post Reply

Return to “[3.3.x] Support Forum”