Al-ʿAynī, after quoting the report through Ibn Mājah, remarked: “I do not consider it sound.” He then added: “Ibn Mājah also records—on the authority of Ibn ʿAbbās—‘Purify the mosques and do not make them thoroughfares; let no menstruating woman pass through them, nor anyone in a state of major ritual impurity sit in them—except one merely passing by; let no arrows be scattered therein, no sword drawn, no legal punishment executed, and let no poetry be recited therein. If someone does recite, it is to be said to him: May Allah silence your mouth.’”
I say: I have not found this narration in Ibn Mājah, nor does al-Nābulusī cite it in al-Dhakhāʾir, and I have not located it in any of the ḥadith works at my disposal. In my estimation it is not authentic, and Allah knows best.
The Prophet ﷺ alluded to this same principle when he declared, “Block off every small doorway that opens into this mosque except the doorway of Abū Bakr.”
The hadith is transmitted from Ibn ʿAbbās (may Allah be pleased with him): “The Messenger of Allah ﷺ came out during the illness from which he passed away, his head bound with a cloth. He sat upon the pulpit, praised and extolled Allah, and then said, ‘There is no one among the people who has been more loyal to me—with his person and his wealth—than Abū Bakr ibn Abī Quḥāfah. Were I to take an intimate friend from among mankind, I would surely have taken Abū Bakr as a friend; but the fellowship of Islam is superior. Therefore, close off …’” and so on.
Al-Bukhārī and Aḥmad have recorded this hadith, as noted earlier under the seventh matter that should be observed in constructing mosques.
Al-Qurṭubī said in his Tafsīr: “He ﷺ ordered the doors to be closed because leaving them open would lead people to use the mosque as a passageway and a route to cross through …”