Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:7189Abū ʿAbdullāh al-Ḥāfiẓ > Abū Bakr Muḥammad b. Jaʿfar al-Muzakkī > Ibrāhīm b. Abū Ṭālib > Abū Kurayb > Muʿāwiyah b. Hishām > ʿImrān b. Abū Anas > ʿAṭāʾ > Ibn ʿUmar

[Machine] The Messenger of Allah ﷺ said, "Remember the good qualities of your deceased and refrain from mentioning their faults." The scholar (may Allah have mercy on him) said, "It has been narrated in a hadith from Ma'mar on the authority of Thabit, who reported from Anas, that he said: A funeral procession passed by the Prophet ﷺ and he said, "Speak well of him." So they spoke well of him. Another procession passed by and he said, "Speak ill of him." So they spoke ill of him. There is evidence in this hadith that they only praised one funeral and criticized the other when the Prophet ﷺ commanded them to praise them. And there is evidence that it is permissible to mention what is known about a person when there is a need for it, such as asking a judge or something similar to that. It is as if those who spoke ill of him were proclaiming his evil and the Prophet ﷺ wanted to deter people like him from their evil deeds and from indulging in idle talk. So he said, "What did he say? Allah knows best."  

البيهقي:٧١٨٩وَأَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ أنبأ أَبُو بَكْرٍ مُحَمَّدُ بْنُ جَعْفَرٍ الْمُزَكِّي ثنا إِبْرَاهِيمُ بْنُ أَبِي طَالِبٍ ثنا أَبُو كُرَيْبٍ ثنا مُعَاوِيَةُ بْنُ هِشَامٍ عَنْ عِمْرَانَ بْنِ أَبِي أَنَسٍ عَنْ عَطَاءٍ عَنِ ابْنِ عُمَرَ قَالَ

قَالَ رَسُولُ اللهِ ﷺ اذْكُرُوا مَحَاسِنَ مَوْتَاكُمْ وَكُفُّوا عَنْ مَسَاوِئِهِمْ قَالَ الشَّيْخُ رَحِمَهُ اللهُ قَدْ رُوِّينَا فِي حَدِيثِ مَعْمَرٍ عَنْ ثَابِتٍ عَنْ أَنَسٍ أَنَّهُ قَالَ مُرَّ بِجِنَازَةٍ عَلَى النَّبِيِّ ﷺ فَقَالَ أَثْنُوا عَلَيْهِ فَأَثْنَوْا خَيْرًا وَمُرَّ بِأُخْرَى فَقَالَ أَثْنُوا عَلَيْهِ فَأَثْنَوْا شَرًّا وَفِيهِ دَلَالَةٌ عَلَى أَنَّهُمْ إِنَّمَا أَثْنَوْا عَلَى الْجِنَازَتَيْنِ عَلَى إِحْدَاهُمَا بِالْخَيْرِ وَعَلَى الْأُخْرَى بِالشَّرِّ عِنْدَ أَمْرِ النَّبِيِّ ﷺ بِالثَّنَاءِ عَلَيْهِمَا وَفِيهِ دَلَالَةٌ عَلَى جَوَازِ ذِكْرِ الْمَرْءِ بِمَا يَعْلَمُهُ مِنْهُ إِذَا وَقَعَتِ الْحَاجَةُ إِلَيْهِ نَحْوَ سُؤَالِ الْقَاضِي الْمُزَكِّي وَمَا أَشْبَهَ ذَلِكَ وَكَأَنَّ الَّذِي أَثْنَوْا عَلَيْهِ شَرًّا كَانَ مُعْلِنًا بَشَرِّهِ فَأَرَادَ النَّبِيُّ ﷺ زَجْرَ أَمْثَالِهِ عَنْ شُرُورِهِمْ وَعَنْ إِطَالَةِ الْأَلْسِنَةِ فِي أَنْفُسِهِمْ فَقَالَ مَا قَالَ وَاللهُ أَعْلَمُ