Does anyone know how I could check whether a username that is in segment_2 is actually a legitimate username? And, if it isn’t, how to redirect to a 404?
I’ve got the query module checking the DB, but I can’t seem to get the logic correct if it returns nothing.
{exp:query sql="SELECT exp_members.username AS query_username
FROM exp_members
WHERE '{segment_2}' = exp_members.username;"}
{query_username}
{/exp:query}Thank you!