Full Sharh — Mishkat al-Masabih 1579
وَعَنْ أَنَسٍ قَالَ: مَرُّوا بِجَنَازَةٍ فَأَثْنَوْا عَلَيْهَا خَيْرًا. فَقَالَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «وَجَبَتْ» ثُمَّ مَرُّوا بِأُخْرَى فَأَثْنَوْا عَلَيْهَا شَرًّا. فَقَالَ: «وَجَبَتْ» فَقَالَ عُمَرُ: مَا وَجَبَتْ؟ فَقَالَ: «هَذَا أَثْنَيْتُمْ عَلَيْهِ خَيْرًا فَوَجَبَتْ لَهُ الْجَنَّةُ وَهَذَا أَثْنَيْتُمْ عَلَيْهِ شَرًّا فَوَجَبَتْ لَهُ النَّارُ أَنْتُم شُهَدَاء الله فِي الأَرْض» . وَفِي رِوَايَةٍ: «الْمُؤْمِنُونَ شُهَدَاءُ اللَّهِ فِي الْأَرْضِ»
English Translation
Anas told that when some people passed a dead body on a bier and spoke highly of the dead man the Prophet said, “It is certain.” When they passed another and spoke very badly of the dead man he said, “It is certain.” ‘Umar asked what was certain, and he replied, “You spoke highly of this one, so paradise is certain for him; but you spoke very badly of that one, so hell is certain for him. You are God’s witnesses in the earth.” (Bukhari and Muslim.) A version has “The believers are God's witnesses in the earth.”
Source
Mishkat al-Masabih(مشكاة المصابيح)
Funerals
Hadith Number
1579