[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. I don't know why leaving this open for everyone.