If I know a user name (e.g. "SteveO") whose account was deleted sometime around middle of January this year, is it possible to find out its userid (and thus its current username "user" shown in its posts)? Thanks.
1 Answer
Beyond what was offered by Erik von Asmuth earlier you can only find out if a user has been relatively active in either commenting but even better, close voting.
The first method relies on the fact that users are @-reply-ed in a comment. You can then create a query that looks for earlier comments on the same post for a user that is deleted. The anonymized (that IS a word!) displayname contains the original userid.
The second method relies on the fact that users that participate in successful close voting (> 3K rep needed) have their userid and displayname recorded in the posthistory table. With some JSON parsing magic you can reveal those.
I have captured both methods in this SEDE query
declare @username varchar(200) = ##userdisplayname:string?H2CO3##
select distinct top 100
uc.id as [Comment Link]
, pv.userdisplayname [potential userid]
from comments uc -- all comments ...
inner join comments pv on pv.postid = uc.postid -- previous comments
and pv.id < uc.id
left outer join users u on u.id = pv.userid -- from users ...
where uc.text like concat('@', @username, ' %') -- collate sql_latin1_general_cp1_ci_ai
and u.id is null -- ... that are now deleted
select distinct JSON_Value(ph.text,concat('$.Voters[', num.value , '].Id')) [potential userid]
from posthistory ph
, string_split('0,1,2,3,4', ',') num -- [0..4] (max 5 close voters)
where posthistorytypeid = 10 -- closed
and JSON_Value(ph.text,concat('$.Voters[', num.value , '].DisplayName')) = @username
This is as much as us mortals can do. If this doesn't work for you, either grab an older datadump, run for moderator or get hired as SE Dev.
Let me mention here that some countries have legislation that allow their citizens to be forgotten. If users have chosen to delete their account that has to be respected. Don't use these techniques to hunt down, online or in real life, users and confront them with posts they no longer wanted to be associated with.
-
Thanks. How shall I learn to use SEDE? One part I need to be familiar with T-SQL. The other I need to learn about the schemas of the tables in the databases available in SEDE. Correct? How would you approach the two parts? For example, nice books to learn T-SQL (I am more familiar with postgresql)? links to schemas of the tables ?– TimJun 23, 2018 at 16:13
-
4@Tim I recommend to get started with the SEDE tutorial which is written by Monica. The SEDE tag on MSE is pretty filled with loads of queries and beyond the schema documentation you'll find one post where I have done an ERD.– reneJun 23, 2018 at 17:32
-
It is indeed a word but spelled differently. I happend to know the equivalent German word so I looked it up. Here's the result: dict.leo.org/englisch-deutsch/anonymisiert -> anonymized– MafiiJun 25, 2018 at 7:25
user123456
. But why? You wouldn't be able to view the deleted user's profile.