Sayyiduna Abdullah bin Amr bin al-As (may Allah be pleased with them both) said: We buried a man together with the Messenger of Allah (peace and blessings be upon him). When we turned back and came level with his door, there was a woman coming towards us; we did not think he knew her. He (peace and blessings be upon him) said: "O Fatimah, where have you come from?" She said: "I have come from the people of this house; I sympathised with them and offered them condolence, and prayed for their deceased." He (peace and blessings be upon him) said: "Perhaps you went with them as far as al-Kuda (the graveyard)?" She said: "Allah forbid that I should go as far as al-Kuda, when I have heard from you (peace and blessings be upon him) what you say about it!" He (peace and blessings be upon him) said: "Had you gone with them as far as al-Kuda, you would not see the door of Paradise until your father's grandfather sees it." And al-Kuda means the graveyard.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7090
Ja'far bin Muhammad (may Allah have mercy on him) narrates from his father (may Allah have mercy on him), and he from his grandfather (may Allah have mercy on him), that when the Messenger of Allah (peace and blessings be upon him) passed away, those offering condolence came, and they heard someone saying: In Allah Almighty there is consolation for every calamity, a replacement for every loss, and recompense for everything that is missed. So hold fast to Allah Almighty alone and place your hope in Him, for the truly afflicted one is he who has been deprived of the reward.
Its meaning has also been narrated through another route from Ja'far, from his father, from Jabir, and through another route from Anas bin Malik, and there is weakness in its chains. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7091
Husayn bin Abi A'ishah narrates from Abu Khalid, that is, al-Walibi, that the Prophet (peace and blessings be upon him) consoled a man and said: 'Yarhamuka Allahu wa ya'juruka' (May Allah have mercy on you and reward you).
This is mursal.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7092