عَنْ أَبِي هُرَيْرَةَ قَالَ: سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «مَنْ جَاءَ مَسْجِدي هَذَا لم يَأْته إِلَّا لِخَيْرٍ يَتَعَلَّمُهُ أَوْ يُعَلِّمُهُ فَهُوَ بِمَنْزِلَةِ الْمُجَاهِدِ فِي سَبِيلِ اللَّهِ وَمَنْ جَاءَ لِغَيْرِ ذَلِكَ فَهُوَ بِمَنْزِلَةِ الرَّجُلِ يَنْظُرُ إِلَى مَتَاعِ غَيْرِهِ» . رَوَاهُ ابْنُ مَاجَهْ وَالْبَيْهَقِيُّ فِي شُعَبِ الْإِيمَانِ
Translation

Malik said that ‘Umar built a courtyard called al-Butaiha’ in the neighbourhood of the mosque and said, “If anyone wants to make a noise, or recite poetry, or raise his voice, he must go out to this courtyard.” He transmitted it in al-Muwatta'.