Hakim b. Hizam said that God's Messenger prohibited retaliation being taken in a mosque, the recitation of poems in it, and the infliction of punishment in it.
Abu Dawud in his Sunan and the author of Jami‘ al-usul ( Ibn al-Athir) in his work transmitted it from Hakim, but in al-Masabih it is transmitted from Jabir.
Narrated Abu Huraira reported God’s Messenger as saying:
When you see anyone buying or selling in a mosque, say, “May God not make your trading profitable!” And when you see anyone calling out in it about something lost, say, “May God not restore it to you.”
Mu'awiya said on the authority of his father that God’s Messenger forbade these two plants, i e., onions and garlic, and said, “He who eats them must not come near our mosque.” He also said, “If you must eat them, suppress their odour* by cooking.”
‘Amr b. Shu'aib on his father’s authority reported his grandfather as saying that God’s Messenger prohibited the recitation of poems in a mosque, buying and selling in it, and sitting in a circle in a mosque on Friday before the prayer.