diff --git a/src/app/admin/users/[user_id]/page.jsx b/src/app/admin/users/[user_id]/page.jsx index 253d9539..c37f4dc3 100644 --- a/src/app/admin/users/[user_id]/page.jsx +++ b/src/app/admin/users/[user_id]/page.jsx @@ -5,8 +5,12 @@ import { sql } from "@/lib/db"; async function user_properties(id) { const isNumeric = (value) => value.length !== 0 && [...value].every((c) => c >= "0" && c <= "9"); - if (isNumeric(id)) + if (isNumeric(id)) { + // if it is a discord ID + if(id.length >= 10) + return (await sql`SELECT * FROM users WHERE id = (SELECT "userId" FROM accounts where "providerAccountId" = ${id})`)[0]; return (await sql`SELECT * FROM "users" WHERE id = ${id} LIMIT 1;`)[0]; + } else return (await sql`SELECT * FROM "users" WHERE REPLACE(name, ' ', '') = ${id.replace("%20", "")} LIMIT 1;`)[0]; }