[WIP] Correctly get users from database, refs #1268.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1268
| Refs tickets  | ---
| License       | MIT
| Doc PR        | ---

This only fixes the PHP side of the bug. But it still doesn't work. As I don't know why, I'll leave this open for everyone.

**Update: It seems working now.**