Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:4325Abū ʿAbdullāh al-Ḥāfiẓ > Abū al-ʿAbbās Muḥammad b. Yaʿqūb > Muḥammad b. Isḥāq > Yaḥyá b. Abū Bukayr > Abū Jaʿfar / al-Rāzī > Zayd b. Aslam > ʿAṭāʾ b. Yasār

[Machine] In his statement {And do not approach them while you are in a state of janabah until you have bathed} [Surah An-Nisa: 43], he said: "Do not enter the mosque while you are in a state of janabah, unless you have a valid reason to be there, and do not sit in it." Abu Nuaim reported from Abu Ja'far that he said: "Except if you are passing through."  

البيهقي:٤٣٢٥أنبأ أَبُو عَبْدِ اللهِ الْحَافِظُ ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ ثنا مُحَمَّدُ بْنُ إِسْحَاقَ ثنا يَحْيَى بْنُ أَبِي بُكَيْرٍ ثنا أَبُو جَعْفَرٍ يَعْنِي الرَّازِيَّ ثنا زَيْدُ بْنُ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنِ ابْنِ عَبَّاسٍ

فِي قَوْلِهِ {وَلَا جُنُبًا إِلَّا عَابِرِي سَبِيلٍ حَتَّى تَغْتَسِلُوا} [النساء 43] قَالَ لَا تَدْخُلِ الْمَسْجِدَ وَأَنْتَ جُنُبٌ إِلَّا أَنْ يَكُونَ طَرِيقُكَ فِيهِ وَلَا تَجْلِسْ وَرَوَاهُ أَبُو نُعَيْمٍ عَنْ أَبِي جَعْفَرٍ وَقَالَ إِلَّا وَأَنْتَ مَارٌّ تَمُرُّ فِيهِ