Mosques and places of Prayer - Section 3 Mishkat al-Masabih 743
Arabic hadith text
وَعَنِ الْحَسَنِ مُرْسَلًا قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «يَأْتِي عَلَى النَّاسِ زَمَانٌ يَكُونُ حَدِيثُهُمْ فِي مَسَاجِدِهِمْ فِي أَمْرِ دُنْيَاهُمْ. فَلَا تُجَالِسُوهُمْ فَلَيْسَ لِلَّهِ فِيهِمْ حَاجَةٌ» . رَوَاهُ الْبَيْهَقِيّ فِي شعب الْإِيمَان
Translation
Al-Hasan reported in mursal form that God's Messenger said, “A time is coming when people will talk in their mosques about their worldly affairs, so do not sit with them, for God has nothing to do with them.” Baihaqi transmitted it in Shu'ab al-iman.