Correct use of the past perfect tense
The basic meanings of the past perfect are ‘earlier past’ and ‘completed in the past’. A common use of the past perfect tense is to ‘go back’ when we are already talking about the past, so as to make it clear that something had already happened at the time we are talking about.
I realized that I had seen him before. (NOT I realized that I saw him before.) (Here we are talking about something that had already happened at the time we are talking about.)
The patient had died before the doctor arrived.
When I arrived at the party, Jane had already gone home.
The past perfect tense is common after past verbs like told, realized, asked, wondered, thought etc.
She told me that she had already finished the job.
The past perfect tense is also used to talk about unrealized hopes and wishes. This usually happens after if, wish and would rather.
I wish you had told me the truth.
If you had told him the truth he would have forgiven you.
Cases where the past perfect tense is not used
The past perfect tense is used only as described above. It is not used to simply say that something happened some time ago. To express that meaning we use the simple past.
I met John yesterday. (NOT I had met John yesterday.)
His father died two years ago. (NOT His father had died two years ago.)