'Amr bin Shu'aib narrated from his father, from his grandfather, that:
the Messenger of Allah (ﷺ) forbade lashing for the legal punishment in the mosques. (JA)
English reference (JA): Vol. 3, Book 20, Hadith 2600 (JA)
Arabic reference (JA): Book 20, Hadith 2698 (JA)