# How to look up a user based on a user\_id?

**URL:** https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739
**Category:** Support
**Created:** [05.Май.2016 15:09:04 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739 "2016-05-05T15:09:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SkritterJosh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skritterjosh/32/121854_2.png) [@SkritterJosh](https://meta.discourse.org/u/SkritterJosh)
#### Post date: [05.Май.2016 15:09:04 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739/1 "2016-05-05T15:09:04Z")

</div>

I’ve been looking at sidekiq and noticing an abnormally high number of failed Jobs::UserEmail jobs. Looking into the arguments almost all of them seem to be coming from the same user id. _It’s import to note that all other emails are sending normally._

`{"type"=>"digest", "user_id"=>398, "current_site_id"=>"default"}`

`Jobs::HandledExceptionWrapper: Wrapped Net::SMTPServerBusy: 401 4.1.3 Bad recipient address syntax`

I’m unable to actually find the user by id to figure out where all these failed attempts are coming from. Any thoughts?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [05.Май.2016 16:28:23 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739/2 "2016-05-05T16:28:23Z")

</div>

I’m not sure if you can through the Discourse interface, but you could use the Rails console:

```
u = User.find(398)

```

- [How do I open the Rails console in Discourse Docker in production mode? - #4](https://meta.discourse.org/t/how-do-i-open-the-rails-console-in-discourse-docker-in-production-mode/16970/4)

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [06.Май.2016 08:14:20 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739/3 "2016-05-06T08:14:20Z")

</div>

Alternatively, you can use the awesome [Data Explorer plugin](https://meta.discourse.org/t/data-explorer-plugin/32566):

```sql
SELECT *
FROM users
WHERE id = 398

```

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [06.Май.2016 20:15:03 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739/4 "2016-05-06T20:15:03Z")

</div>

For me the quickest way is simply to make a request like this whilst logged in as admin:  
`http://discourse.example.com/admin/users/398.json`

This will get the user by ID `398`.

Yes, the result is JSON but it’s pretty easy to read the first few lines.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [08.Июнь.2024 12:45:40 UTC](https://meta.discourse.org/t/how-to-look-up-a-user-based-on-a-user-id/43739/5 "2024-06-08T12:45:40Z")

</div>

Эта тема была автоматически закрыта через 2955 дней. Новые ответы больше не допускаются.
