Why do we say "who you were" and not "whom you were"? Isn't it the object of the verb?

Solution 1:

Who in the clause who you were is not the object of you. Only transitive verbs can have an object; and the verb to be is not transitive. It is a copula verb that "links the subject to a subject-related predicative complement†". For this reason who is correct in the sentence: Nobody had any idea who you were.

†The definition of copula in the Oxford Dictionary of English Grammar, p102.

Solution 2:

Who1 are you? (who1 is to mean nominative.)

Whom4 have you met? (Whom4 is accusative.)

As nouns have identical forms in nominative and accusative and as English has only a few pronoun forms with a special accusative (he × him, she × her, who1 × whom4) whom4 was shortened to who (dropping the m). For learners it is a bit difficult to distinguish who1 and who4, but it can't be helped: you have to learn it.

In the sentence "Nobody had any idea who you were" you have who1 and not who4.

In the present tense the sentence would be: "Nobody knows/has any idea who1 you are." Who4/whom4 would not make any sense.

Ultimately the subordinate clause contains the question: "Who1 are you?"