(a) Nafi' narrates from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said during the expedition of Khaybar: "Whoever eats from this plant should not come to the mosques."
(b) In the narration of Imam Ahmad (may Allah have mercy on him): "He should not come near the mosques."
(c) Musaddad (may Allah have mercy on him) added: "(Meaning garlic) whoever has eaten it should not come to our mosque."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5049