Funeral prayer at the place of burial [i.e. graveyard].
There are two opinions which have been transmitted from Ahmad bin Hanbal regarding the issue. There is no harm with it. Ibn Munzir said that Naafi' mentioned that Abu Hurairah prayed upon 'Aisah and 'Um Salamah in the middle of the graves of al-baQii' and Ibn Umar was present. Umar bin 'abd al-'aziiz did that. The second opinion transmitted from Ahmad bin Hanbal is that it is makruuh [disliked].
That has been transmitted from 'Ali, 'Abd Allaah bin 'Amr bin al-'aaS, Ibn Abbaas and it is the opinion of 'aTaa', al-nakha'i, al-Shaafi'i, 'ishaaQ and Ibn Munzir because of a saying attributed to the Prophet (sallallaahu alayhi wa sallam)
All of the earth is a masjid except for the places of burial and the bathrooms
While some have considered this hadiith to be authentic, others have said it is not authentic.
Reference(s):
al-Mughni Volume 2 Page 369
Doror Encyclopedia of hadiith
Uqba bin 'Amir said:
There were three times at which Allah's Messenger (sallallaahu alayhi wa sallam) forbade us to pray, or bury our dead: When the sun begins to rise till it is fully up, when the sun is at its height at midday till it passes over the meridian, and when the sun draws near to setting till it sets.
[Sahih Muslim Hadith No. 831]
Based on the above Hadiith Ahmad bin Hanbal said that prayer over the dead is disliked at three times: at the time of Tuluu al-shams, miday, and at the time of ghuruub al-shams
Reference(s):
al-Mughni Volume 2 Page 413
Ibn Qudaamah writes: Some of the Companions of al-Shaafi said that one is to not pray over the deceased [i.e. funeral prayer] over the grave after one month. Others from his Companions say one can pray up to an unlimited time. Ibn 'Aqiil has chosen this opinion because of the following hadiith:
Narrated `Uqba bin Amir:
Allah's Messenger (sallallaahu alayhi wa sallam) offered the funeral prayers of the martyrs of Uhud eight years after (their death), as if bidding farewell to the living and the dead, then he ascended the pulpit and said, "I am your predecessor before you, and I am a witness on you, and your promised place to meet me will be al-hauD [i.e. the meeting is on the Day of Resurrection], and I am (now) looking at it from this place of mine. I am not afraid that you will worship others besides Allah, but I am afraid that worldly life will tempt you and cause you to compete with each other for it." That was the last look which I cast on Allah's Messenger (sallallaahu alayhi wa sallam).
[Sahih al-Bukhaari and Sahih Muslim - wording is of Sahih al-Bukhaari]
Abu Hanifah was of the opinion that the wali can pray up to three [days] and no one else can pray in any case. 'ishaaQ was of the opinion that the one who was absent can pray up to one month while the present can pray up to three [days].
Reference:
al-Mughni
Volume 2 Page 387
Ibn Qudaamah writes [paraphrase]: The one who misses the funeral prayer can pray at the grave [over the deceased]. The person who misses the funeral prayer can pray over it as long as the body has not been buried. And he can pray at the grave up to a month. This is the saying of the majority of people of knowledge from among the Companions of the Prophet (sallallaahu alayhi wa sallam) and others. It has been transmitted from:
أبي موسى
ابن عمر
عائشة
It is also the opinion of al-Shaafi and al-'awzaa'i.
al-Thawri, Maalik, and Abu Hanifah said that the prayer is not to be repeated over the deceased except by the wali if he was absent. [According to them] if it had been permissible to pray at the grave for anyone who missed the funeral prayer then people would pray over the Qabr of the Prophet (sallallaahu alayhi wa sallam) in all eras.
Reference(s):
al-Mughni Volume 2 Page 381
Ibn Qudaamah says in al-Mughni Volume 2 Page 358 - 359 that the person who has most right to lead the funeral prayer over the deceased is the person who was requested by the deceased to do so. He says this is the Madhab of:
أنس
زيد بن أرقم
أبي برزة
سعيد بن زيد
أم سلمة
ابن سيرين
He also says that there is an Ijmaa of the Companions (may Allah be pleased with them) on the matter.
Ibn Baaz is of the opinion that the person who has the most right to lead the funeral prayer is the regular Imaam even if the deceased had requested someone else to lead the prayer. He cites the following hadiith for evidence for his position.
"No man should lead another man in prayer in his place of authority.”